I've got a json file included in my javascript that defines a variable that looks like this:
var places_json = {
"count": 13476,
"places": [{
"area": "London",
"county": "STS",
"lat": 52.300151820000004,
"lon": -2.36665606,
"code": "7567",
"id": 1
},
{
"area": "Sheffield",
"county": "STS",
"lat": 51.33648680000003,
"lon": 0.98861179000000001,
"code": "9919",
"id": 6
},
{
"area": "Huxton",
"county": "STS",
"lat": 53.27483902,
"lon": -1.0146250700000001,
"code": "9953",
"id": 11
},
]
}
And I want to retrieve the value of area for the entry whose id is 11, using Javascript.
Does anyone know how to do this? It's too hard for me - my Javascript is not that advanced. If I knew the array index of the entry that I need, then I could do:
var entry = json_places.places[i]
but I don't know it, unfortunately, just the value of id (which is unique).
Thanks in advance.