I'm working with a GeoJSON dataset that is formatted like this:
{
"type": "Feature",
"properties": {
"startcong": "109",
"district": "7",
"statename": "Pennsylvania",
"member": {
"112": {
"21168": {
"party": "Republican",
"name": "Meehan, Pat",
"district": "7"
}
},
"109": {
"15447": {
"party": "Republican",
"name": "Weldon, Curt", "district": "7"}
},
"110": {
"20744": {
"party": "Democrat",
"name": "Sestak, Joe",
"district": "7"
}
},
"111": {
"20744": {
"party": "Democrat",
"name": "Sestak, Joe",
"district": "7"
}
}
},
"endcong":
"112",
"id": "042109112007"
}
}
I'm struggling with how to access these nested objects. For instance, I can use feature.properties.member[112][21168]
to access the party
attribute. However:
- That second numbered object ("21168") is not always consistently numbered.
- That second numbered object is always the only nested object.
Is there a way to access that same party
attribute using something like a wildcard? Ideally, something akin to feature.properties.member[112][*].party
.