RESTful sensor json_attributes_path (template / scripting)

Can’t seem to get JSONPath to work with a script. This works perfect in the JSONPath evaluation tool but doesn’t work in homeassistant. I have also tried templates and it doesn’t seem to work either. What am I doing wrong or is this not possible?

  - platform: rest
    resource: https://enviro.epa.gov/enviro/efservice/getEnvirofactsUVHOURLY/ZIP/63385/JSON
    name: UV Index
    json_attributes_path: "$[(new Date().getHours() - 6)]"
    json_attributes:
      - ORDER
      - UV_VALUE
      - DATE_TIME
    value_template: "{{ value_json[now().hour - 6].UV_VALUE }}"