I have some JSON data from a third-party and I am using JSON Path to transform the data. Below is a sample of the JSON data and the expressions I am trying.
{
"Traveller": [
{
"FirstName": "Passenger",
"LastName": "One",
"EmailAddresses": {
"Email": {
"EmailAddress": [
"[email protected]",
"[email protected]"
]
}
}
},
{
"FirstName": "Passenger",
"LastName": "Two",
"EmailAddresses": {
"Email": {
"EmailAddress": "[email protected]"
}
}
}
]
}
I can get the array of email address fine using the following expression:
$..Traveller[*].EmailAddresses.Email.EmailAddress[*]
Returns
[
"[email protected]",
"[email protected]"
]
But I require an expression which will return just the "[email protected]".
I have tried the following expressions:
$..Traveller[*].EmailAddresses.Email.EmailAddress.*
$..Traveller[*].EmailAddresses.Email.EmailAddress[2]
I think I need someway of filtering to the EmailAddress where it is NOT an array.