This is an example for looping JSON structure and reading values.
var s = [{key:1,value:"abc"},{key:2,value:"def"},{key:3,value:"xyz"},{key:1,value:"pqr"}]
for(var i in s)
console.log ("Key :" + s[i].key + " - Value :" + s[i].value)
//Output
Key :1 - Value :abc
Key :2 - Value :def
Key :3 - Value :xyz
Key :1 - Value :pqr
var s = [{key:1,value:"abc"},{key:2,value:"def"},{key:3,value:"xyz"},{key:1,value:"pqr"}]
for(var i in s)
console.log ("Key :" + s[i].key + " - Value :" + s[i].value)
//Output
Key :1 - Value :abc
Key :2 - Value :def
Key :3 - Value :xyz
Key :1 - Value :pqr
No comments:
Post a Comment
Your feedback is always appreciated. I will try to reply to your queries as soon as time allows.Please don't spam,spam comments will be deleted upon reviews.