How can retrieve all elements from Json backend parsing with inifinity datasource?

Dear all,
I’m pretty sure my question is quite boring for you all but I’m not able to get a satisfying results.
I’m trying to create a variable with infinity datasource with Json.
attached my json
{
“2024”: [
“ciao”,
“mamma”,
“papa”,
“papa”,
“noi”,
“voi”
]
}
with this Root $.“2024” I’m not retrieving all elements but just unique one.

What I’m doing wrong?

Thanks a lot
Nicola

  • What Grafana version and what operating system are you using?

  • What are you trying to achieve?

  • How are you trying to achieve it?

  • What happened?

  • What did you expect to happen?

  • Can you copy/paste the configuration(s) that you are having problems with?

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.

  • Did you follow any online instructions? If so, what is the URL?

Grafana v11.4.0
I would achieve everey elements from the json based on data
I’m not retrieving all elements but the unique ones only.

welcome @nick81m

so in your json data do you have data other than 2024? If so please provide the whole json data other than 2024

Hello yosiasz,
of course, attached full json.

{
"2024": [
"ciao",
"mamma",
"papa",
"papa",
"noi",
"voi"
],
"2025": [
"pippo",
"pluto",
"topolino",
"topolino",
"minnie",
"papero"
]
}

i move form one year to the other by variable. so the root would be $.“${year}”.

what I would achieve is what normally i achieved with custom variable.

let me know if I answered to your request

thanks a lot

1 Like

and what is the final result you want to see

selecting 2024 i get this
image
only unique elements.
I would get this
image

1 Like

try jsonata

great!!!
thank you very much.
I have last but not least…I would display only elements matching year link $distinct($.2024)

is that a question?

Apologize yosiasz, I’m realizing that I’m not clear enough in my explation.
I try to do better.
i have a json with two main object based on years (2024 and 2025).
for each year I have a list of elements. selecting the year by a variable i would retrieve all elements for selected year.
What i got till now are only unique values from selected year. Waht i owuld get instead is the full list of elements for selected year.

let me know if it’s clear

distinct function is not doing what i’m looking for
image

this will help you

on how to use the where clause to filter json

thank you.
I’ll have a look into your link.
I’m still stucking on the issue getting only unique elements instead of all elements.
Anyway, i’ll try to fix it

1 Like