MQTT Creating Sensor from Array (?)

I have the following data from my MQTT topic:

{
    "zoneData": {
        "holidays": [
            {
                "index": 0,
                "fromAsIso": "2023-02-21",
                "toAsIso": "2023-02-24",
                "added": false,
                "deleted": false,
                "changed": false,
                "osv": false
            }
        ],
   }
}

I guess this is an array? I fail creating a sensor for the value “fromAsIso”. The only thing I am able to create, is a sensor Elco holidays:

mqtt:
  sensor:
    - name: Elco Holidays
      unique_id: elco_holidays
      state_topic: "remocon/hvac"
      value_template: "{{ value_json.zoneData.holidays }}"

The value of this sensor is:
[{‘index’: 0, ‘fromAsIso’: ‘2023-02-21’, ‘toAsIso’: ‘2023-02-24’, ‘added’: False, ‘deleted’: False, ‘changed’: False, ‘osv’: False}]

I have tried the following, which apparently did not work:

mqtt:
  sensor:
    - name: Elco Holidays Start Date
      unique_id: elco_holiday_startDate
      state_topic: "remocon/hvac"
      value_template: "{{ value_json.zoneData.holidays.fromAsIso }}"
    - name: Elco Holidays Start Date V2
      unique_id: elco_holiday_startDate2
      state_topic: "remocon/hvac"
      value_template: "{{ value_json.zoneData.holidays[1] }}" 

I couldn’t find anything in the forum.

value_json.zoneData.holidays[0]

EDIT: you can copy/paste it in a viewer to help getting the path, e.g Online JSON Viewer (stack.hu)

1 Like

Thanks for your help! I have found what I need thanks to your answer.
The solution is:
value_json.zoneData.holidays[0].fromAsIso