I have 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 get the value areafor the record for which it idis 11 using Javascript.
Does anyone know how to do this? This is too complicated for me - my Javascript has not advanced. If I knew the index of the record array I needed, then I could do:
var entry = json_places.places[i]
but I don’t know, unfortunately, just the id value (which is unique).
Thanks in advance.
AP257 source
share