Now I am using vibed JSON module, but I do not know how to get access to nested elements without iteration it with foreach.
Here is my 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 would like to do something like: result.passedtests
. But here result is an array.
I found perfect solution:
[0]
is becauseresult
is array, and we access to it's first element.