This page covers ArduinoJson 5.13.5, consider upgrading to version 6.21.2.
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 = jsonBuffer.createArray(); array.add("A"); array.add("B"); array.add("C"); array.remove(1); array.printTo(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
JsonBufferfast 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.