Hello,
I’m getting stuck and confused trying to extract some JSON values from a rest sensor. Help would be very much appriciated.
I would like to extract from below the two “items” from the value_json and write each attribute like name, status translated, delay, etc. into a sensor.
{## Imitate available json data: ##}
{% set value_json = {
"items": [
{
"name": "WAN_GW",
"address": "fe66::77a9:c4aa:fed2:b234",
"status": "none",
"status_translated": "Online",
"loss": "~",
"stddev": "~",
"delay": "~"
},
{
"name": "WAN_PPPOE",
"address": "92.111.33.244",
"status": "none",
"loss": "0.0 %",
"delay": "5.7 ms",
"stddev": "0.2 ms",
"status_translated": "Online"
}
],
"status": "ok"
} %}
{## Extraxt json date into sensors: ##}
{{ value_json }}
{{ value_json.status }}
{{ value_json["items"]["name"][WAN_PPPOE]["stddev"] }}