This is my c# post json method .In the result variable
I got the following json response
string token = string.Empty;
string requestUrl = "http://tallentex.com/phpwebservices/feedbackapp/index.php/hostel_service/syncData";
HttpWebRequest httpWebRequest = WebRequest.Create(requestUrl) as HttpWebRequest;
httpWebRequest.Method = "POST";
httpWebRequest.ContentType = "x-www-form-urlencoded";
using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
{
string json = new JavaScriptSerializer().Serialize(new
{
id = "0"
});
Console.WriteLine(json.ToString());
streamWriter.Write(json);
streamWriter.Flush();
streamWriter.Close();
}
var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
{
var result = streamReader.ReadToEnd();
}
This what i got from json post method request.
{\"status\":1,\"data\":\"id\":\"1\",\"fno\":\"16078134\",\"hostel_id\":\"12345\",\"attn_no\":\"0010146998\",\"create_date\":\"2017-08-21 10:31:02\"},{\"id\":\"2\",\"fno\":\"16078134\",\"hostel_id\":\"12345\",\"attn_no\":\"0010146998\",\"create_date\":\"2017-08-21 10:31:02\"},{\"id\":\"3\",\"fno\":\"16078134\",\"hostel_id\":\"12345\",\"attn_no\":\"0010146998\",\"create_date\":\"2017-08-21 10:31:02\"},{\"id\":\"4\",\"fno\":\"16078134\",\"hostel_id\":\"12345\",\"attn_no\":\"0010146998\",\"create_date\":\"2017-08-21 10:31:02\"}]}";
I want to convert it into data table like the following table
id fno attnno hostelid createdate
1 16078134 0010146998 12345 2017-08-21 10:31:02
2 16078134 0010146998 12345 2017-08-21 10:31:02
3 16078134 0010146998 12345 2017-08-21 10:31:02
4 16078134 0010146998 12345 2017-08-21 10:31:02