Automation with file json, Help

You’re jumping ahead to implementation in your problem description: there’s no need for a loop.

Please post code correctly formatted. I would have liked to have used your example JSON to test, but it’s too fiddly with all the “smart” quotes.

You need a RESTful integration sensor like this:

rest:
  - resource: YOUR_URL
    scan_interval: 86400
    sensor:
      - name: "Current energy price"
        value_template: >
          {{ (value_json
              |selectattr('time','eq',(now().time()|string)[:3] ~ '00')
              |first)['price'] }}
        unit_of_measurement: 'EUR/kWh'

Then an automation to update it at the top of each hour:

trigger:
  - platform: time_pattern
    minutes: 0
action:
  - service: homeassistant.update_entity
    target:
      entity_id: sensor.current_energy_price

This doesn’t use the date in the JSON. That’s easy enough to add if needed.