0

I have two objects (JSON)

game : {id: "1XXXXXXXXX"}

I can get it like that to get a String with the ID

JSON.stringify(game.id)
"1XXXXXXXXX"

And I have another with lots of info, something like that

object{
    Mike{
        0{
           id:"236XXXXXXX"
           name:"vvvv"
           price:"23"
        }
        1{
           id:"1XXXXXXXXXX"
           name:"vvvvv"
           price:"56"
        }  
    } 
}

How can I get the price if I have the id but I have no idea about the location inside the object?

user229044
  • 232,980
  • 40
  • 330
  • 338
gil13
  • 114
  • 1
  • 10
  • 1
    You don't need to do `JSON.stringify(game.id); "1XXXXXXXXX"` you can just do `game.id`? – user229044 Mar 02 '15 at 21:06
  • The question has been closed, but you can also check out UnderscoreJS http://underscorejs.org/#findWhere – sbolel Mar 02 '15 at 21:07
  • Related: [How to filter object array based on attributes?](http://stackoverflow.com/questions/2722159/javascript-how-to-filter-object-array-based-on-attributes) – Ram Mar 02 '15 at 21:09

0 Answers0