Note that there are some explanatory texts on larger screens.

plurals
  1. POparsing Json using system.web.script.seriarilization or using json.net
    text
    copied!<pre><code>json ="{ "data": [ { "id": "1000", "from": { "name": "Anthony Waema", "category": "message", "id": "192" }, "message": "this is the message", "updated_time": "2001-05-06T19:34:15+0000", "likes": { "data": [ { "id": "100001692250255", "name": "\u00dcnal Turanl\u0131" }, { "id": "100001060078996", "name": "S\u00e9f\u00e2 K\u00e2ql\u00e4Nn" }] }, { "id": "10150186255753553", "from": { "name": "another name", "category": "message", "id": "100001" }, "message": "this is the message", "updated_time": "2001-04-06T19:34:15+0000", "likes": { "data": [ { "id": "1002345", "name": "\u00dcnal Turanl\u0131" }, { "id": "100234", "name": "S\u00e9f\u00e2 K\u00e2ql\u00e4Nn" }] } } ] }"; public class Allstatus { public List&lt;sdata&gt; data { get; set; } public scpaging paging { get; set; } } public class sdata { public string id { get; set; } public sfrom from { get; set; } public string message { get; set; } public string updated_time {get; set;} public List&lt;likesdata&gt; likes { get; set; } } public class likesdata { public string id{ get; set; } public string name{ get; set; } } public class sfrom { public string name {get; set;} public string category {get; set;} public string id {get; set;} } JavaScriptSerializer ser = new JavaScriptSerializer(); page = ser.Deserialize&lt;allstatus&gt;(json); foreach (sdata cd in page.data) { foreach(likesdata ld in cd.likes.data) { Console.WriteLine(ld.id+"\t"+ld.name); } } </code></pre> <p>problem: I need to parse the json and retrieve likes data. I can access "from" data but not "likes" data.. I get nullreference error when I do this. help needed here.. Thanks.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload