So what is your question exectly? The JSON path to the data you want would be data.0.1
or data[0][1]
. However, HA comes with the feature to extract the values for you. For testing I installed this sensor (Yes cats, because its the internet ):
rest:
- resource: https://catfact.ninja/fact
scan_interval: 10
sensor:
- name: "fact"
value_template: "{{ value_json.fact }}"
json_attributes_path: "$."
The JSON provided by this API looks like:
{
"fact": "The strongest climber among the big cats, a leopard can carry prey twice its weight up a tree.",
"length": 94
}
In the developer tools → templating a simple {{ states('sensor.fact') }}
gives:
A cat has more bones than a human being; humans have 206 and the cat has 230 bones.