I have one scenario where i need to go through a loop in JSON
The data looks like this.
Code: Select all
{
"meta": {
"code": 200,
"msg": "This is test"
},
"data": {
"id": "69",
"name":"newName"
"roles": [
{
"vendorID": "15",
"isLocal": false,
"dName": "vendor2",
"permissions": [
{
"roleID": "13",
"isDefaultRole": true,
"rPermission": [
{
"permission": 1,
"rName": "Dashboard_User"
}
]
}
]
},
{
"vendorID": "5",
"isLocal": true,
"dName": "vendor1",
"permissions": [
{
"roleID": "13",
"isDefaultRole": true,
"rPermission": [
{
"permission": 1,
"rName": "Dashboard_User"
}
]
}
]
}
],
}
}
Assume i have got all of this in a variable HTMLResult and then i start picking up the results
The code which i wrote looks like this
Code: Select all
JSONParse>HTMLResult,data,result
JSONParse>HTMLResult,data.roles[0],result
What i am trying to do here is Check
data>roles>
and then check if "isLocal" is true
then pick roleId for that node.
In order to do so , i will need to loop through this JSON on node : roles.
JSONPrase function cab be used if i can get count of the elements.
Is there a way ?
Go easy as this is first post and this can be pretty lame post for me in beginning.Appreciated effort whoever took time to read through.
Thanks
Javed