Description

JsonArrayConst is a read-only version of JsonArray. It’s also twice smaller because it doesn’t contain a pointer to the memory pool.

Example

// compute the required size
const size_t CAPACITY = JSON_ARRAY_SIZE(3);

// allocate the memory for the document
StaticJsonDocument<CAPACITY> doc;

// parse a JSON array
deserializeJson(doc, "[1,2,3]");

// extract the values
JsonArrayConst array = doc.as<JsonArray>();
for(JsonVariantConst v : array) {
    Serial.println(v.as<int>());
}

Member functions