I am making a curl request and the response in the in form like this:
data: [
{
data: {
transaction: [
[timestamp1, value1],
[timestamp2, value2],
[timestamp3, value3],
[timestamp4, value4],
]
}
}
]
}
What I am doing
curl $url | jq -r '.data[].data[].tansaction'
which is giving output
[ [key1: value1],[key2: value2], [key3: value], [key4: value] ]
What I want to is to store the above result in an array so that I can iterate over it. Final goal is to get each pair key and value and perform some operation over it
How can I do it in shell script?
{key1: value1}instead of[key1: value1]?{"key1": "value1"}.jq -r '.data[].data[].tansaction | <iterate over it here>'. Typically, you wouldjq ... @tsv | while IFS=$'\t' read ....