Help, json query sensor

hi all, i have absolut no knowledge about json. I wantto crate an crypto dash with the most important values for me. now i have many sensors done with taapi.io and works nice. but i ned the value from monthly rsi, but taapi.io dont have that so i found an other provider but he gives me an json as result with a lot of infos back. Now i want to create an sensor from that data.

how to handle that ? pls take a at the pictures.

i only need the marked value

would be nice if i get it work.

###################

for now i played with the template edit and get the value i need with that:

{{ (value_json[“Technical Analysis: RSI”][“2024-04-25”].RSI) }}

but the second item “2024-04-25” changing daily so i cant let it fix like that. is there any sign to tell json that he just use it like an “*” or something.

Honestly ChatGPT or Gemini are both great at answering questions like this. Just give it your JSON and what data you want to extract. Since you posted a picture of your data, I can’t do that for you :slight_smile:

{
“Meta Data”: {
“1: Symbol”: “BTCUSDT”,
“2: Indicator”: “Relative Strength Index (RSI)”,
“3: Last Refreshed”: “2024-04-25”,
“4: Interval”: “monthly”,
“5: Time Period”: 14,
“6: Series Type”: “close”,
“7: Time Zone”: “US/Eastern Time”
},
“Technical Analysis: RSI”: {
“2024-04-25”: {
“RSI”: “65.3962”
},
“2024-03-31”: {
“RSI”: “72.3617”
},
“2024-02-29”: {
“RSI”: “68.0403”
},
“2024-01-31”: {
“RSI”: “56.4954”
},
“2023-12-31”: {
“RSI”: “56.2574”
},
“2023-11-30”: {
“RSI”: “52.6067”
},
“2023-10-31”: {
“RSI”: “49.9878”
},
“2023-09-30”: {
“RSI”: “42.6668”
},
“2023-08-31”: {
“RSI”: “41.6083”
},
“2023-07-31”: {
“RSI”: “44.0375”
},
“2023-06-30”: {
“RSI”: “44.9557”
},
“2023-05-31”: {
“RSI”: “42.0026”
},
“2023-04-30”: {
“RSI”: “43.3386”
},
“2023-03-31”: {
“RSI”: “42.6988”
},
“2023-02-28”: {
“RSI”: “38.1746”
},
“2023-01-31”: {
“RSI”: “38.1655”
},
“2022-12-31”: {
“RSI”: “32.4771”
},
“2022-11-30”: {
“RSI”: “32.7424”
},
“2022-10-31”: {
“RSI”: “34.1199”
},
“2022-09-30”: {
“RSI”: “33.2809”
},
“2022-08-31”: {
“RSI”: “33.5142”
},
“2022-07-31”: {
“RSI”: “34.6784”
},
“2022-06-30”: {
“RSI”: “32.4011”
},
“2022-05-31”: {
“RSI”: “36.5425”
}
}
}

I want ever extract only the value “65.3962” from RSI from the first block:

"Technical Analysis: RSI": {
    "2024-04-25": {
        "RSI": "65.3962"

Pasting that into an online JSON validator that doesn’t pass validation. Are you missing some braces?

Paste your json in a code block, or use

This gets the RSI value of the most recent date entry:

{% set k = value_json['Technical Analysis: RSI'].keys()|max %}
{{ value_json['Technical Analysis: RSI'][k]['RSI'] }}

In future, please post code in code blocks (like the very end of your second post). I had to go through correcting all the “smart quotes” in the JSON that I pasted into my test which is why I only included the first two items.

The smart quotes that you get from pasting code as plain text into the forum are also the reason why:

1 Like

Thank you so much. it works !