我有一个这样的Json
那么我应该怎样修改我的代码才能让它正常工作呢?
{ "nodes" : [{"id" : "36018","title" : "Fotarı","date" : "20.09.2012 00:45", "short_description" : "Dünrina, rr!","bigimage_width" : "468","bigimage" : "https://qew","croppedimage" : "https://qwe.jpg"},{"id" : "36009","title" : "ey","date" : "20.09.2012 00:03", "short_description" : "İntız!","bigimage_width" : "220","bigimage" : "https://312.jpg","croppedimage" : "https://41172.jpg"},{"id" : "35915","title" : "ai!","date" : "20.09.2012 00:02", "short_description" : "Ssdi...","bigimage_width" : "220","bigimage" : "https://qwe.qwe" : "https://asd.asd"},...
所以我做了这件事
。JObject j = JObject.Parse(x); // x is downloaded JSon code
JArray sonuc = (JArray)j["nodes"];
但是现在我有了
[{"id":"1","name":"news"},{"id":"2","name":"hardware"},{"id":"3","name":"software"},{"id":"4","name":"\internet"},{"id":"6","name":"tv!"},{"id":"7","name":"texts"},{"id":"8","name":"update"},...
那么我应该怎样修改我的代码才能让它正常工作呢?
JObject j = JObject.Parse(x); // gives JsonReaderException exception here
JArray sonuc = (JArray)j[""];