HowTo convert grafana data to key value pairs?

i’m quite new to make and i would like to use the workflow to get und store some data…

getting data from grafana source, get the data converted to a required api structure to store the data

more or less i have the following data:

                        },
                        "data": {
                            "values": [
                                [
                                    1753221600000,
                                    1753222500000,
                                    1753223400000,
                                    1753224300000,
                                    1753225200000,
                                    1753226100000,
                                    1753227000000
                                ],
                                [
                                    0,
                                    0,
                                    0,
                                    0,
                                    0,
                                    0,
                                    null
                                ]
                            ]
                        }

the first part are timestamps and second are the corresponding values
i would like to get them transformed in something like

{
"timestamp": 1753221600000,
"value": 0
}

i tried a lot didn’t got it working.

what i achieved (after hours …)

[
  {
    "json": "[{'id':1,'values':[1753221600000,1753222500000,1753223400000,1753224300000,1753225200000,1753226100000,1753227000000]},{'id':2,'values':[0,0,0,0,0,0,null]}]"
  }
]

but i do not get velue pairs done ..

ideas welcome

thanks a lot

Lars

1 Like

Heyy @lblabr Welcome to the community!

Follow this steps:

  1. Parse the JSON

  2. Iterate any 1 array


  3. Use text aggregator or Json aggregator based on your need. For JSON aggregator help read this use case solution :backhand_index_pointing_right: Optimal way to merge two arrays based on a common field? - #2 by Prem_Patel

Map values like this.

Output

You can use Set Variable module if you need all of them seperately.

I hope this helps!

Best,
@Prem_Patel