JSON to timeseries

Hi everyone.

I’m using a JSON API that returns me a JSON like this:

{
“1701234000”:“65.1”,
“1701234300”:“65.1”,
“1701234600”:“65.1”,
“1701234900”:“65.0”,
“1701235200”:“64.9”
}.
The keys are time and the values are temperatures, I need to transform it to a time serie but I’m not sure how to do it.

I have tried to make transformations, but I still can’t get Grafana to interpret that these keys are time.

Somebody could help me?

Welcome @javiergo2502

Did you try the extract Transformation?

Hello @yosiasz
Yes I try it, i look a table like this:


but if i select a timeseries visualization Grafana says “Data is missing a number field”, As a test I have transformed some values into number type but there it tells me “Data is missing a time field” and there I get stuck because I don’t know how to tell him that the keys are dates.

If you have an idea on how to solve that that would be great, I have tried several days and I have not been able to

try using jsonata

parse-json
| jsonata "$each($, function($v, $k) { { 'time':$number($k),'value': $number($v)} })"

https://try.jsonata.org/mtx8ukqxq

I think that it doesn’t works if a mada an extract transformation, it only changes the values, and i get a table like this:


But if I don’t do the transformation directly I get a NaN

I’m not sure if I’m doing the query correctly, in try.jsonNata he show me the information well, with a field time and other field value, but Grafana only show me it:
image
I should make something more?

We cant see your query

In JsonNata
https://try.jsonata.org/T4sO4U_T1
In Grafana

Thanks you so much, it works

1 Like