I've searched for this and I while I'm sure its simple, I can't seem to get this to work. I need to loop through the JSON below in bash
{
"data":
[
{
"seen": true,
"id": "2079a988-f856-4adb-bd3d-49ddf775ba16-1629277814281",
"tinyId": "17290",
"status": "closed",
"acknowledged": false,
"isSeen": true
},
{
"seen": false,
"id": "0a6e6024-9e80-42d2-ae4f-4b4af4a25fd2-1629277649193",
"tinyId": "17289",
"status": "open",
"acknowledged": false,
"isSeen": false
},
{
"seen": false,
"id": "108370f4-f54e-443d-9b7c-eec9d641c69a-1629277622211",
"tinyId": "17288",
"status": "open",
"acknowledged": false,
"isSeen": false
}
]
}
The loop needs to read all the fields, so I can pass them to variables and check their values.
I've been trying with JQ and have tried
for x in "${json}"; do <something with "${x}">; done
and also
for x in "$(jq -r . <<< "${json}"); do <something with "${x}">; done
but it seems the output is not splitting.
Thanks,