I'm trying create a json expression path that returns the id when the reference with {" id ":" 00000000000000000000000004640254 "}
. I have tried with
$.[?(@.Relationship[?(@.Ref.id=='00000000000000000000000004640254')])].id
but it doesn't return data
Json message is
[
{
"id": "234567890234567890",
"Relationship": [
{
"type": "Indirect",
"Ref": {"id": "00000000000000000000000004640253_01"}
},
{
"type": "Direct",
"Ref": {"id": "00000000000000000000000004640254"}
}
],
"Specification": {"id": "Gold123AS"}
},
{
"id": "234567890234567891",
"Relationship": [
{
"type": "Indirect",
"Ref": {"id": "00000000000000000000000004640253_02"}
},
{
"type": "Direct",
"Ref": {"id": "00000000000000000000000004640253"}
}
],
"Specification": {"id": "Gold123AS"}
}
]
if someone can help me, thanks
$..[?(@.id=='234567890234567891')]
- This will give you the elements against the ID passed.$..[?(@.id=='234567890234567891')]..['type']
- This will give you the type related to the id passed.$..[?(@.id=='234567890234567891')]..['id']
- This will give you all the ID present for the array. – rajesh