My question is very similar to one found here -
I have the following JSON
{
"FOO": {
"id": "23432423",
"Result": {
"Status": "SUCCESS",
"Reason": ""
}
},
"BAR": {
"id": "45345535",
"Result": {
"Status": "FAILURE",
"Reason": ""
}
},
"BAZ": {
"id": "123432423",
"Result": {
"Status": "SUCCESS",
"Reason": ""
}
}
}
Using jq I wanted the original object format back filtering on status FAILED
Result:
"BAR": {
"id": "45345535",
"Result": {
"Status": "FAILURE",
"Reason": ""
}
}
I tried both solutions suggested from above post
to_entries | map(select(.value.Status=="FAILURE")) | from_entries
and 'with_entries(select(.value.Status =="FAILURE"))'
both are giving empty results. Going round and round. Any help apprecaited