Automation failing when using the result of rest sensor

I am trying to use the result of a rest call to automate a hue scene. while I can view the sensor attributes in a test card, and I can manually run services to change the hue scence, I can’t put it all together into the correct automation script.

I have the below sensor:

The sensor is a rest call to https://api.coingecko.com/api/v3/simple/price?ids=filecoin&vs_currencies=usd&include_24hr_change=true

The result doesn’t seem to be true json (it has single quotes rather than double quotes) so i changed value_template. The fact that the cards work and let me retrieve the usd and the usd_24h_change attributes. The sensor yaml is:

sensor:
    - name: "Crypto - Filecoin"
      json_attributes_path: "$.filecoin"
      value_template: '{% set result = value_json|to_json %}
                        {{ result.filecoin.usd_24h_change }}'
      json_attributes:
       - filecoin
       - usd
       - usd_24h_change

Finally, my automation file is:

- id: '1635056726769'
  alias: Green 24hr change positive
  description: Change Light Colour
  trigger:
   - platform: time
     hours: 0
     minutes: '/1'
     seconds: 0
  condition:
    condition: template
    value_template:  '{{ (state_attr("sensor.crypto_filecoin.usd_24h_change")|int) > 0 }}'
  action: call-service
  service: hue.hue_activate_scene
  service_data:
    group_name: Living room A1
    scene_name: Stonks only go up

Which can be saved, but i get the below error in the log files:

Invalid config for [automation]: expected dictionary @ data['action'][0]. 
Got None extra keys not allowed @ data['service']. 
Got None extra keys not allowed @ data['service_data']. 
Got None invalid template (TemplateSyntaxError: unexpected ')') for dictionary value @ data['condition'][0]['value_template']. 
Got None. (See /config/configuration.yaml, line 9).

I’ve tried various options and i still get the unexpected ‘)’. HA is pretty new to me but I’ve been able to find most problems i have had recently online. The problem now might be related to a few different issues so it is harder to google. Any help would be appreciated.

fixed it by getting a better api that returned back proper json and then manually creating a similar automation in the UI and editing it after it was created.

final automation was:

- id: '1635256134980'
  alias: 24 Hour Change Positive
  description: ''
  trigger:
  - platform: time_pattern
    hours: 0
    minutes: '/1'
    seconds: 0
  condition:
  - condition: template
    value_template: '''{{ value_json[0]["1d"]["price_change"] | round(4) > 0 }}'''
  action:
  - service: hue.hue_activate_scene
    data:
      group_name: Living room A1
      scene_name: Stonks only go up
  mode: single