mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-08-14 01:54:48 +02:00
Updated API Reference (markdown)
@@ -317,6 +317,8 @@ will write the following string to the serial output:
|
||||
|
||||
Removes the element at the specified index.
|
||||
|
||||
**IMPORTANT**: This function doesn't free the memory allocated to the element in the `JsonBuffer`. This behavior has been prefered to keep the `JsonBuffer` fast and small, which is a fundationnal principle of the library.
|
||||
|
||||
##### Signature
|
||||
|
||||
```c++
|
||||
@@ -334,7 +336,14 @@ JsonArray& array = jsonBuffer.createArray();
|
||||
array.add("A");
|
||||
array.add("B");
|
||||
array.add("C");
|
||||
array.printTo(Serial); // ["A","B"]
|
||||
array.removeAt(1);
|
||||
array.printTo(Serial);
|
||||
```
|
||||
|
||||
will print the following string to the serial output:
|
||||
|
||||
```json
|
||||
["A","C"]
|
||||
```
|
||||
|
||||
|
||||
@@ -825,20 +834,49 @@ will write the following string to the serial output:
|
||||
```
|
||||
|
||||
|
||||
### JsonObject::remove()
|
||||
|
||||
##### Description
|
||||
|
||||
Removes the element at the specified key.
|
||||
|
||||
**IMPORTANT**: This function doesn't free the memory allocated to the element in the `JsonBuffer`. This behavior has been prefered to keep the `JsonBuffer` fast and small, which is a fundationnal principle of the library.
|
||||
|
||||
##### Signatures
|
||||
|
||||
```c++
|
||||
void remove(const char* key);
|
||||
void remove(const String& key);
|
||||
```
|
||||
|
||||
##### Arguments
|
||||
|
||||
`key`: the key to remove from the object.
|
||||
|
||||
##### Example
|
||||
|
||||
```c++
|
||||
JsonObject& object = jsonBuffer.createObject();
|
||||
object["A"] = 1;
|
||||
object["B"] = 2;
|
||||
object["C"] = 3;
|
||||
object.remove("B");
|
||||
object.printTo(Serial);
|
||||
```
|
||||
|
||||
will print the following string to the serial output:
|
||||
|
||||
```json
|
||||
{"A":1,"C":3}
|
||||
```
|
||||
|
||||
|
||||
:construction:
|
||||
|
||||
:construction: Below this line, the writing is still in progress...
|
||||
|
||||
:construction:
|
||||
|
||||
#### JsonArray::removeAt()
|
||||
##### Description
|
||||
Removes element at specified index.
|
||||
##### Signatures
|
||||
##### Arguments
|
||||
##### Return value
|
||||
##### Example
|
||||
|
||||
#### JsonArray::set()
|
||||
##### Description
|
||||
##### Signatures
|
||||
|
Reference in New Issue
Block a user