Hi all,
I’m trying to search through a complex json file with multiple levels. I’ve managed to create a working json query on the top level.
$[?(@.number==‘${mortgagenumber}’)]
This one is returning all the data as expected. However when i’m trying to search a level deeper, i’m running into issues and the queries are not returning any data only an empty array.
Examples of failing queries:
$[?(@.number==‘${mortgagenumber}’)].loanParts[?(@.number==‘${laonpartnumber}’)
$[*].persons[?(@.personNumber==‘$personnumber’)].fullName
The simplified request body I’m working with:
[{
"number": "69131",
"commercialLabel": "Commercial name 1",
"productName": "Productname 1",
"loanParts": [
{
"number": 163,
"productName": "Product name 1"
},
{
"number": 171,
"productName": "Product name 2"
}
],
"persons": [
{
"personNumber": 354315,
"fullName": "M. Yole"
},
{
"personNumber": 354316,
"fullName": "R. Bealy"
}
]
}]
As a reference I tried to validate the query but in the online tool it seems to work fine:
Part of the code block:
${json}= Set Variable ${response.json()}
Set Global Variable ${json}
${actuele_persoons_gegevens} Get Value From Json ${json} $[*].persons[?(@.personNumber=='354315')].fullName
List Should Contain Value ${actuele_persoons_gegevens} ${verwachte_persoons_gegevens['volledigenaam']}
Who knows the answer for a working query?
Thanks in advance,
Peter