javascript - Check for a value in a JSON object -


I have to find out that an ID is in my JSON object, for example:

 "{{"} ":" General "," created ":" {{"}": "{{"} ":" 2009-07-25T14: 12: 25 + 01: 00 "," channel ": [{" id ": 1," name " 2009-07 -25 14:00:02 "}]}  

Especially I need to see if my ID (say, 2) would be in channels is. I .id . How can this be done?

Try this:

  var id = 2, found = false ; For (var i = 0; i & lt; channels.length; i ++) {if (channel [i] .id == id) {found = true; break; }}  

Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -