Reputation: 671
Is there a way to deserialize such json
{
"photos": [
19,
{
"pid": 288777129,
"aid": -6
},
{
"pid": 286441792,
"aid": -6
},
{
"pid": 114893258,
"aid": 34465839
}
]
}
with C# DataContractJsonSerializer
without modifying the source. I mean the first element 19.
Upvotes: 3
Views: 670
Reputation:
I usually use the JavascriptSerializer
class instead:
JavaScriptSerializer js = new JavaScriptSerializer();
Object obj = js.DeserializeObject(str);
Response.Write(obj["photos"][0]); // 19
Upvotes: 1