I have a following json
{
"status": "success",
"data": {
"resultType": "matrix",
"result": [{
"metric": {},
"values": [[1573452693.024, "36380.58030773418"], [1573452707.024, "51397.82785694454"], [1573452721.024, "38711.55804872829"], [1573452735.024, "47801.74418514242"], [1573452749.024, "42140.81258908656"]]
}]
}
}
Using jq I extract values in with following way:
curl "LINK" | .\\jq.exe -c '.data.result[].values'
But that returns string and I need to iterate through received array. What I need to do with these values: 1. Get pairs; 2. Change Unix TimeStamp to readable one; 3. Save in CSV. How can I extract get the array as the output?
Edit for comment in Thor answer with expanded json:
{
"status": "success",
"data": {
"resultType": "matrix",
"result": [{
"metric": {"container_name":"name1"},
"values": [[1573452693.024, "36380.58030773418"], [1573452707.024, "51397.82785694454"], [1573452721.024, "38711.55804872829"], [1573452735.024, "47801.74418514242"], [15734 52749.024, "42140.81258908656"]]
},{
"metric": {"container_name":"name2"},
"values": [[1573452693.024, "36380.58030773418"], [1573452707.024, "51397.82785694454"], [1573452721.024, "38711.55804872829"], [1573452735.024, "47801.74418514242"], [15734 52749.024, "42140.81258908656"]]
},{
"metric": {"container_name":"name3"},
"values": [[1573452693.024, "36380.58030773418"], [1573452707.024, "51397.82785694454"], [1573452721.024, "38711.55804872829"], [1573452735.024, "47801.74418514242"], [15734 52749.024, "42140.81258908656"]]
}
]
}
}