I have a JSON response which I was able to filter to a format like the one below using jayway jsonpath syntax:
[
{
"entityName" : "Financial Assets",
"entityFullPath" : [
"Path123",
"Alternative"
]
},
{
"entityName" : "123",
"entityFullPath" : [
"Path123",
"Alternative"
]
}
]
jsonpath:
$..domainEntity[?(@.dataObjectId !== null)].['entityName','entityFullPath']
What I want to do further, is to get only the first value from entityFullPath array - is that case Path123, so the final JSON would look like this:
[
{
"entityName" : "Financial Assets",
"entityFullPath" : [
"Path123"
]
},
{
"entityName" : "123",
"entityFullPath" : [
"Path123"
]
}
]
Or even better (not sure if you can get rid of json array like that using only jsonpath):
[
{
"entityName" : "Financial Assets",
"entityFullPath" : "Path123"
},
{
"entityName" : "123",
"entityFullPath" : "Path123"
}
]
Is such drill down doable using only jsonpath? I'm using jayway flavor.