I am using JSONPath to filter out a json file, I am trying to retrieve both the Key + Value from the JSON array but I am lost at figuring how best to do this.
QUERY
$.phoneNumbers[*].[type,number]
ARRAY
{
"firstName": "John",
"lastName" : "doe",
"age" : 26,
"address" : {
"streetAddress": "naist street",
"city" : "Nara",
"postalCode" : "630-0192"
},
"phoneNumbers": [
{
"type" : "iPhone",
"number": "0123-4567-8888",
"address" : {
"streetAddress": "naist street",
"city" : "Nara",
"postalCode" : "630-0192"
}
},
{
"type" : "home",
"number": "0123-4567-8910",
"address" : {
"streetAddress": "naist street",
"city" : "Nara",
"postalCode" : "630-0192"
}
}
]
}
CURRENT OUTPUT
[
"iPhone",
"0123-4567-8888",
"home",
"0123-4567-8910"
]
Desired Outcome
[
{
"type" : "iPhone",
"number": "0123-4567-8888",
},
{
"type" : "home",
"number": "0123-4567-8910",
}
]