Given JSON structured like this:
{
"name":"Some Guy",
"emails":[
{
"description":"primary",
"status":"UNVERIFIED",
"email":"first@first-email.com"
},
{
"description":"home",
"status":"VERIFIED",
"email":"second@second-email.com"
},
{
"description":"away",
"status":"VERIFIED",
"email":"third@third-email.com"
}
]
}
I would like a JSONPath expression to get the first email with status VERIFIED
and if there are none, then just get the first email in the array. So, given the example above, the result would be second@second-email.com
. Given this example:
{
"name":"Some Guy",
"emails":[
{
"description":"primary",
"status":"UNVERIFIED",
"email":"first@first-email.com"
},
{
"description":"home",
"status":"UNVERIFIED",
"email":"second@second-email.com"
}
]
}
the result would be first@first-email.com
.
Is this possible with a JSONPath expression?