I have the following JSON file list.json
:
[
{
"$type": "Profile",
"ReferenceId": "6e374d9e-5bbe-4015-acd7-ae6f04de0db5",
"Name": " aaa"
},
{
"$type": "Profile",
"ReferenceId": "5c055f82-696b-48c2-9b7f-a540d48fcd19",
"Name": " bbb"
}
]
In bash, I would like to extract in variable the value of the first occurance of the key "ReferenceId" where the key "Name" equal "bbb".
I tried jq -r ".[] | select(.Name==\"bbb?take=300") | .ReferenceId" < list.json
but nothing works. I suppose i need to use --slurpfile but I don't see how to do that.
Thx in advance for your replies.