vir
vir

Reputation: 1091

How can I parse the following JSON for WP7?

In addition ,I would recommend that please refer the link below for a similar thread which provides some solutions for the same issue.

Problem deserializing JSON in a Silverlight program

Hope it can help you.

Upvotes: 1

Views: 112

Answers (1)

ie.
ie.

Reputation: 6101

You should use DataContractJsonSerializer for json deserialization and HttpWebRequest for getting data purposes.

Here is a piece of my code where I'm using DataContractJsonSerializer:

    //...
    if (CheckError((HttpWebResponse) webResponse)) return;

    var serializer = new DataContractJsonSerializer(typeof(Message[]), new[] { typeof(Message) });
    var stream = webResponse.GetResponseStream();
    _networkMessages = (Message[])serializer.ReadObject(stream);
    //...

Upvotes: 1

Related Questions