How to pass around a json array, from REST sensor to ApexCharts

I’ve been trying without much success to graph a REST response with this structure:

{
  "minutely": [
    {
      "dt": 1609459200,
      "precipitation": 0.1
    },
    {
      "dt": 1609459260,
      "precipitation": 0.0
    },
    ... # 60 elements in this array
  ]
}

I’d like to use this to graph a Apex chart, where dt is x-axis and precipitation is y-axis.
However, it doesn’t seem to like json flowing inside the system, or I’m having difficulties to debug. The state in dev tools always shows Unknown.

This is my attempt. (sorry my first time doing this)

    sensor:
      - name: "Rain Next Hour"
        value_template: "{{ value_json.minutely }}"
        json_attributes:
          - minutely
type: custom:apexcharts-card
series:
  - entity: sensor.rain_next_hour
    data_generator: >
      const data = [];
      const minutely = states["sensor.rain_next_hour"].attributes.minutely;
      for (const point of minutely) {
        const timestamp = point;
        const value = point.precipitation;
        data.push([timestamp, value]);
      }
      return data;