ESPHOME Json parsing

Hello,

Im in trouble ESPHOME json parsing.
I want to create an array with 50 integer, values are from mqtt…
Can anyone help me how to do that ?

globals:
  # Define 50 start times and 50 stop times for each switch (32 switches)
  - id: switch1_start_times
    type: uint32_t[50]
 
  - id: switch1_stop_times
    type: uint32_t[50]
 #   initial_value: [0] * 50  # Initialize to zeroes

 




  on_json_message:
    topic: poolcontrol/schedule/R1/start
    then:
      - lambda: |-
          auto start_times = json["start_times"].as<JsonArray>();
          auto stop_times = json["stop_times"].as<JsonArray>();

          // Store the start and stop times for Switch 1
          for (int i = 0; i < 50; i++) {
            id(switch1_start_times)[i] = start_times[i].as<uint32_t>();
            id(switch1_stop_times)[i] = stop_times[i].as<uint32_t>();
          }