Transform JSON Data into usable data for the "time series panel"

  • What Grafana version and what operating system are you using?
    Grafana v10.3.3 on Ubuntu 22 LTS

  • What are you trying to achieve?
    Transform data in a way that I can visualize it in a time series panel.

  • How are you trying to achieve it?
    Because of the way I receive the data I have to use data transformation. I’m just not able to achieve it the way I need it.

This is the Data I got:

[
	{
		"date": "2022-06-29T13:23:36+0200",
		"value": "28.7"
	},
	{
		"date": "2022-07-13T10:48:30+0200",
		"value": "28.7"
	},
	{
		"date": "2022-08-23T15:11:20+0200",
		"value": "28.6"
	},
	{
		"date": "2022-09-30T11:02:49+0200",
		"value": "28.7"
	},
	{
		"date": "2022-10-11T21:52:28+0200",
		"value": "28.7"
	},
	{
		"date": "2022-11-11T16:13:27+0100",
		"value": "25.9"
	},
	{
		"date": "2022-12-23T08:52:53+0100",
		"value": "25.8"
	},
	{
		"date": "2023-01-20T15:49:31+0100",
		"value": "25.8"
	},
	{
		"date": "2023-02-24T09:37:07+0100",
		"value": "25.6"
	},
	{
		"date": "2023-03-24T07:21:24+0100",
		"value": "25.9"
	},
	{
		"date": "2023-04-12T11:51:53+0200",
		"value": "24.0"
	},
	{
		"date": "2023-04-24T15:43:37+0200",
		"value": "23.6"
	},
	{
		"date": "2023-05-25T12:22:33+0200",
		"value": "23.4"
	},
	{
		"date": "2023-06-23T16:17:56+0200",
		"value": "23.4"
	},
	{
		"date": "2023-07-06T12:04:13+0200",
		"value": "16.2"
	},
	{
		"date": "2023-08-24T11:00:06+0200",
		"value": "15.6"
	},
	{
		"date": "2023-09-28T08:28:38+0200",
		"value": "15.6"
	},
	{
		"date": "2023-10-26T11:13:35+0200",
		"value": "9.3"
	},
	{
		"date": "2023-11-23T14:28:04+0100",
		"value": "9.3"
	},
	{
		"date": "2023-11-29T10:32:38+0100",
		"value": "9.3"
	},
	{
		"date": "2023-12-21T14:27:03+0100",
		"value": "9.3"
	},
	{
		"date": "2024-01-26T08:38:02+0100",
		"value": "9.3"
	},
	{
		"date": "2024-02-22T16:43:14+0100",
		"value": "9.2"
	},
	{
		"date": "2024-02-28T13:28:29+0100",
		"value": "9.2"
	},
	{
		"date": "2024-03-07T15:40:13+0100",
		"value": "9.2"
	}
]

Everything is in one column inside a table for now.
Which data transformations do I have to use to use the time series panel in order to see the values changing over time?

Welcome to forum @wrth1337

Using Infinity plugin with UQL query and selecting Format of time series you get.


image

1 Like

Thank you :smile:

I already use infinity to receive the data.
The data I parsed above already ran through some data transformation, I thought it would be easier to work from there.

The raw data looks more like this and comes straight from an api request through infinity:

{"paging":{"pageIndex":1,"pageSize":100,"total":25},"measures":
[{"metric":"coverage","history":
[{"date":"2022-06-29T13:23:36+0200","value":"28.7"},
{"date":"2022-07-13T10:48:30+0200","value":"28.7"},
{"date":"2022-08-23T15:11:20+0200","value":"28.6"},
{"date":"2022-09-30T11:02:49+0200","value":"28.7"},
{"date":"2022-10-11T21:52:28+0200","value":"28.7"},
{"date":"2022-11-11T16:13:27+0100","value":"25.9"},
{"date":"2022-12-23T08:52:53+0100","value":"25.8"},
{"date":"2023-01-20T15:49:31+0100","value":"25.8"},
{"date":"2023-02-24T09:37:07+0100","value":"25.6"},
{"date":"2023-03-24T07:21:24+0100","value":"25.9"},
{"date":"2023-04-12T11:51:53+0200","value":"24.0"},
{"date":"2023-04-24T15:43:37+0200","value":"23.6"},
{"date":"2023-05-25T12:22:33+0200","value":"23.4"},
{"date":"2023-06-23T16:17:56+0200","value":"23.4"},
{"date":"2023-07-06T12:04:13+0200","value":"16.2"},
{"date":"2023-08-24T11:00:06+0200","value":"15.6"},
{"date":"2023-09-28T08:28:38+0200","value":"15.6"},
{"date":"2023-10-26T11:13:35+0200","value":"9.3"},
{"date":"2023-11-23T14:28:04+0100","value":"9.3"},
{"date":"2023-11-29T10:32:38+0100","value":"9.3"},
{"date":"2023-12-21T14:27:03+0100","value":"9.3"},
{"date":"2024-01-26T08:38:02+0100","value":"9.3"},
{"date":"2024-02-22T16:43:14+0100","value":"9.2"},
{"date":"2024-02-28T13:28:29+0100","value":"9.2"},
{"date":"2024-03-07T15:40:13+0100","value":"9.2"}]}]}

How do I go from here?
(And yea, I know, the coverage is quite low :sweat_smile:)

can you tell not what it “looks more like” and post the real real data :laughing:

try this UQL

parse-json
| jsonata "$.measures.history"
1 Like

The UQL suggested by @yosiasz on the data provided by @wrth1337 works perfectly:

1 Like

Looks awesome, thank you guys for the help! :heart:

1 Like