C# Parsing JSON Array(HTTPrequest Response) to display -


good day,

i having parsing json response. let's have json:

{    "data": {        "count" : 3,        "innerdata" : [        {            "datainfo" : "heheh",            "datainfo2" : "hahah",            "datainfo3" : "huhuh"        },                {            "datainfo" : "jejej",            "datainfo2" : "jajaj",            "datainfo3" : "jujuj"        },                {            "datainfo" : "fefef",            "datainfo2" : "fafaf",            "datainfo3" : "fufuf"        }        ]    } } 

okay. if want display datas "datainfo" only..in python, can doing this:

for x in response.json()['data']['innerdata']     print(x['datainfo']) 

that display this:

>>> heheh >>> jejej >>> fefef 

how can in c#? tried this: http://procbits.com/2011/08/11/fridaythe13th-the-best-json-parser-for-silverlight-and-net

but worked non-array json..

hope can guide me,

if use json.net

jobject obj = jobject.parse(file.readalltext("1.json")); foreach (jtoken o in obj["data"]["innerdata"] jarray)     console.writeline(o["datainfo"]); 

Comments