Forums - C# Corner

Forum guidelines
ankit chourasia

ankit chourasia

  • 1.7k
  • 68
  • 1.7k

how to Parse Json string

May 18 2019 2:30 AM
string s =
"{\"SubmitMadLabResult\":\"[{\\\"code\\\":\\\"1\\\",\\\"errorCode\\\":\\\"\\\",\\\"Message\\\":\\\"Success\\\",\\\"bStatus\\\":\\\"true\\\"}]\"}";
i have get  json responce of a web service like above . how to parse this type of json. 
 
 code;-
 
httpRequest.ContentType = "application/json";
httpRequest.Method = "POST";
byte[] bytes = Encoding.UTF8.GetBytes(inputJson);
using (Stream stream = httpRequest.GetRequestStream())
{
stream.Write(bytes, 0, bytes.Length);
stream.Close();
}
string result = string.Empty;
HttpWebResponse response = null;
using (HttpWebResponse httpResponse = (HttpWebResponse)httpRequest.GetResponse())
{
using (Stream stream = httpResponse.GetResponseStream())
{
string StatusCode = httpResponse.StatusCode.ToString();
result = (new StreamReader(stream)).ReadToEnd();
// result= "{\"SubmitMadLabResult\":\"[{\\\"code\\\":\\\"1\\\",\\\"errorCode\\\":\\\"\\\",\\\"Message\\\":\\\"Success\\\",\\\"bStatus\\\":\\\"true\\\"}]\"}"
response = (HttpWebResponse)httpRequest.GetResponse();
}
}
 

Answers (7)