-
What Grafana version and what operating system are you using?
Grafana v10.4.0 (03f502a94d) Community Edition on Docker -
What are you trying to achieve?
I want to show a table with the provided JSON below. -
How are you trying to achieve it?
With the Infinity data source, also tried with the JSON API
I switched to Infinity to try out the UQL. -
What happened?
The rows in my tables are JSON strings instead of displaying them in the table. -
What did you expect to happen?
Display a table, preferably with the dates as columns and the objects within as rows.
The Json
{
"2024-07-05": [
{
"label": "student",
"nb_visits": "32203"
},
{
"label": "shopper",
"nb_visits": "8145"
}
],
"2024-07-06": [
{
"label": "student",
"nb_visits": "31703"
},
{
"label": "shopper",
"nb_visits": "6700"
}
],
"2024-07-07": [
{
"label": "student",
"nb_visits": "32680"
},
{
"label": "shopper",
"nb_visits": "7916"
}
],
"2024-07-08": [
{
"label": "student",
"nb_visits": "49184"
},
{
"label": "shopper",
"nb_visits": "11167"
}
],
"2024-07-09": [
{
"label": "student",
"nb_visits": "47390"
},
{
"label": "shopper",
"nb_visits": "10809"
}
],
"2024-07-10": [
{
"label": "student",
"nb_visits": "43619"
},
{
"label": "shopper",
"nb_visits": "8664"
}
],
"2024-07-11": []
}
The closest I get to a table with UQL is:
parse-json
| project kv()
But it gives me a table like this:
Trying to add logic like this:
parse-json
| project kv()
| mv-expand date=key, visits=value
| mv-expand visit=visits
| project date, label=visit.label, nb_visits=visit.nb_visits
Just returns no data.
Using just the JSON type gives me a table like this:
Which is more like what I want, but I need the JSON arrays in the rows displayed correctly, something like:
label | 2024-07-05 | 2024-07-06 | 2024-07-07 | …and so on |
---|---|---|---|---|
student | 32203 | 31703 | 32680 | … |
shopper | 8145 | 6700 | 7916 | … |
How do I proceed?