What is the best way to get access to nested JSON in D? -


now using vibed json module, not know how access nested elements without iteration foreach.

here json:

{     "hasmore": false,     "result": [{         "ip": "127.0.0.1",         "passedtests": "[firsttest8,firsttest8,firsttest8,firsttest8]",         "guid": ""     }],     "code": 201,     "extra": {         "stats": {             "writesignored": 0,             "scannedindex": 0,             "scannedfull": 1,             "executiontime": 0,             "filtered": 0,             "writesexecuted": 0         },         "warnings": []     },     "error": false,     "cached": false } 

i like: result.passedtests. here result array.

i found perfect solution:

json resultpassedtestsjson = visitorsinfo["result"][0]["passedtests"]; // "[firsttest8,firsttest8,firsttest8,firsttest8]" 

[0] because result array, , access it's first element.


Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -