Reputation: 1
I am trying to call a web-service from an aspx page. The web-service returns json. I need to deserialize the json objects.
I tried to extract the string, it is of the form :
"{ \" d \" : [ { \" _type \" : \" Myclass:#serviceName \", ....other members..}, { ..other records ... }, {...} ] }"
My code is as follows :
Stream receivedStream = HttpWResp.GetResponseStream();
Encoding encode = System.Text.Encoding.GetEncoding("utf-8");
StreamReader reader = new StreamReader(receivedStream, encode);
string text = reader.ReadToEnd(); // text shows the above string
Kindly help me what to do next. Also a refernce of some good articles on the topic would be helpful.
Thanks
Upvotes: 0
Views: 257
Reputation: 942
If you're using an earlier .NET version and/or you want more features, check this out:
Upvotes: 2
Reputation: 6034
Google is your friend: http://www.google.com/search?ie=UTF-8&q=deserialize+json+c%23
The first result looks like it has exactly what you need: http://procbits.com/2011/04/21/quick-json-serializationdeserialization-in-c/
Upvotes: 0