Parse JSON array data

I cannot seem to find the correct term to use in my lambda. I’m parsing data that gives me output as JSON array.

The partial YAML looks like this:

http_request:
  useragent: esphome/device
  timeout: 10s
  id: http_request_data

time:
  - platform: sntp
    # ...
    on_time:
      # Every 1 minutes
      - seconds: 0
        minutes: /1
        then:
          - http_request.get:
              url: URL
              headers:
                Content-Type: application/json
                Kommunenr: NUMBER
                RenovasjonAppKey: API-KEY
                OS: Android
                Connection: Keep-Alive
                Accept-Encoding: gzip
                User-Agent: okhttp/3.2.0
              verify_ssl: false
              on_response:
                then:
                  - lambda: |-
                      json::parse_json(id(http_request_data).get_string(), [](JsonObject root) {
                          id(test_output).publish_state(root[0].Tommedatoer[1]);
                      });
text_sensor:
  platform: template
  name: "test"
  id: test_output

This is how the JSON output looks like:

[{"FraksjonId":1,"Tommedatoer":["2023-10-12T00:00:00","2023-11-09T00:00:00"]},{"FraksjonId":3,"Tommedatoer":["2023-10-12T00:00:00","2023-10-26T00:00:00"]},{"FraksjonId":2,"Tommedatoer":["2023-10-18T00:00:00","2023-11-15T00:00:00"]},{"FraksjonId":7,"Tommedatoer":["2023-10-18T00:00:00","2023-11-15T00:00:00"]},{"FraksjonId":4,"Tommedatoer":["2023-10-26T00:00:00","2023-11-23T00:00:00"]}]

I’m trying to fetch the data from each “FraksjonId”, i will primary be using the first date from within each FraksjonId, but i cannot seem to get the formating correct. I have successfully done a test with another JSON source, that are not array.
It is probably something that i’m missing. I appreciate all inputs to help me solve my issue.

Here’s what worked for me:

Don’t use parse_json if you want to parse an array. This is the way:

        DynamicJsonDocument doc(2048);
        deserializeJson(doc, id(forecast).state);
 
        for (JsonObject elem : doc.as<JsonArray>()) {
          String str = elem["condition"].as<String>();

          it.printf(0,50,id(thumb_font), "%s", str.c_str());
        }