Click here to Skip to main content
15,897,891 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
C#
string json = new WebClient().DownloadString(" http://[doaminName]/rpsconline/rest/kioskWebService/getApplicationStatus?dob=" + dob + "&token_transaction_no=" + mobileno);

string[] s1 = new string[] { "application_id", "candidateName", "dob", "fatherName", "mobileNo", "responseError", "responseStatus", "[", "{", "\"", ":", ".", ",", "}", "]" };
string[] strSplitArr = json.Split(s1, StringSplitOptions.RemoveEmptyEntries);



I am getting problem in json variable, it is giving null values.
Posted
Updated 26-May-14 2:04am
v3
Comments
Nirav Prabtani 26-May-14 7:21am    
Don't write full code ,just write where you have stucked ..it is so irritating to reader , try to improve your question
Kornfeld Eliyahu Peter 26-May-14 7:40am    
'giving null values' - what giving? the split? Check your json returned from web...
Jyoti Bhola 26-May-14 7:41am    
I am using 01/04/1980 for dob variable and 9413210124 for mobileno
Suvabrata Roy 26-May-14 8:04am    
Don't expose domain publicly...

Your solution to try and parse the answer (which is json) as string by yourself is a bad one...
Declare class with the structure of the answer:
C#
public class Result
{
  public string ApplicationID;
  public string CandidateName;
  // so on
}

Then use Json.NET[^] to parse it for you...
C#
Result res = JsonConvert.DeserializeObject<Result[]>(json);
 
Share this answer
 
v3
Comments
Jyoti Bhola 26-May-14 7:59am    
JsonConvert.DeserializeObject
is not working.
You should use array type as JSON is returning an array.

Result res = JsonConvert.DeserializeObject<Result[]>(json);


Another thing you should follow the error message properly it may be case of you are provide wrong query string value with valid key.

That's is : Key :
token_transaction_no
but Value is : MobileNo
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900