Dipit Grover
Dipit Grover

Reputation: 1

deserialize json

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

Answers (2)

silijon
silijon

Reputation: 942

If you're using an earlier .NET version and/or you want more features, check this out:

http://json.codeplex.com/

Upvotes: 2

Sam Peacey
Sam Peacey

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

Related Questions