1

Hi below is my json string which is available in javascript

{
   "101":{"my":"1", "u":"4", "s":false, "isChecked":true},
   "102":{"my":"2", "u":"4", "s":false, "isChecked":false}
   .
   .
   .
   "1000":{"my":"999", "u":"888", "s":true, "isChecked":true}
}

Now -for example- I want to get the values of the isChecked property for each key:

  • "101" "isChecked" is true
  • "102" "isChecked" is false
  • ...
  • "1000" "isChecked" is true

Could please you share any useful snippet of code for this scenario?

4

1 回答 1

0

使用for语句遍历对象:

var data = { /* your data here */ } 
for (var key in data) {
   console.log(key, data[key].isChecked);
}

http://jsfiddle.net/tZzfb/

于 2013-09-12T07:37:03.757 回答