I am trying to find a way to parse below json and get the list of city for all items with "type": "location". The challenge is I don't always know the key names such as us, john and location1 and location2 in the example below. I have tried to use json_query and regex_search without success.
{
"client": {
"us": {
"john": {
"job": {
"type": "job",
"job": "waiter"
},
"location1": {
"type": "location",
"address": {
"street": "Main St",
"city": "Seattle"
}
},
"location2": {
"type": "location",
"address": {
"street": "2nd ave",
"city": "New York"
}
}
}
}
}
}