My JSON is like this (it's valid, it's just too long so I will only paste a part of it):
const world = {
"object": {
"countries": {
"type": "GeometryCollection",
"geometries": [{
"type": "Polygon",
"id": 4,
"arcs": [
[
297,
298,
299,
300,
301,
302
]
]
},
{
"type": "MultiPolygon",
"id": 24,
"arcs": [
[
[
303,
304,
211,
305
]
],
[
[
213,
306,
307
]
]
]
},
{
"type": "Polygon",
"id": 8,
"arcs": [
[
308,
248,
309,
310,
311
]
]
}
]
}
}
}
It's basically a country list, and each country has its own ID.
Now, I was able to select all countries by world.objects.countries
, but I need to select countries with specific IDs, not all of them: either with "id":24
or "id":4
.
I guess I need to use a filter to filter countries with specific IDs inside of them? I'm really just a beginner and the solutions I found are filtered with jQuery, not vanilla javascript.