Scrape information from JSON

Hi all,

I would like some feedback on the following code, i can’t get the information to pop-up in the sensors, i would just like to know how to scrape/rest information from last_value out of the jason (of each attribute). Right now i can rest/scrape the information from the attributes, however…it scrapes everything. I would like to know how i can get last_value per attribute (and have that show up in a sensor).

thanks in advance

  - platform: rest
    resource: https://coronadashboard.rijksoverheid.nl/json/NL.json
    name: corona dashboard
    scan_interval: 60
    value_template: '{{ last_value_json.status }}'
    json_attributes:
     - vaccine_administered_rate_moving_average
     - vaccine_administered
     - vaccine_administered_planned
    
  - platform: template
    sensors:
        infected_people_total:
          value_template: '{{ states.sensor.corona_dashboard.attributes.vaccine_administered_rate_moving_average_last_value }}'
          friendly_name: "Vaccine Moving Rate"
          unit_of_measurement: persons
          icon_template: mdi:test-tube
        vaccine_administered:
          value_template: '{{ states.sensor.corona_dashboard.attributes.vaccine_administered_ggd_last_value }}'
          friendly_name: "Vaccine Administered"
          unit_of_measurement: persons
          icon_template: mdi:needle
        vaccine_administered_planned:
          value_template: '{{ states.sensor.corona_dashboard.attributes.vaccine_administered_planned_last_value }}'
          friendly_name: "Vaccine planned"
          unit_of_measurement: vaccins
          icon_template: mdi:calendar-clock
1 Like

There are several values for those paths. Open https://coronadashboard.rijksoverheid.nl/json/NL.json choose raw data at the top. Then ctrl a and ctrl c and paste it here

https://jsonpathfinder.com/

to find the path for value you are interested in.