Subject to changeVersion 6 is currently in beta, so the API
Unless you need the new features of version 6 (e.g. MessagePack), please use version 5.
Version 6 should stay in beta stage until 2019.
Removes the element at the specified index.
void remove(size_t index);
index: the zero-based position of the element in the array.
JsonArray array = doc.to<JsonArray>(); array.add("A"); array.add("B"); array.add("C"); array.remove(1); serializeJson(array, Serial);
will print the following string to the serial output:
Causes memory leaks
This function doesn’t free the memory allocated to the element in the
This is a conscious design decision made to keep the
JsonDocumentfast and small, which is a fundamental principle of the library.
As a consequence, you cannot remove and add elements in a loop, otherwise the
Don’t try to keep the state of your application in a
JsonArray, instead use custom structures.