mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-08-18 03:51:21 +02:00
Updated FAQ (markdown)
23
FAQ.md
23
FAQ.md
@@ -14,6 +14,29 @@ If you're is case 2., you can solve the problem by increasing the size of the `S
|
||||
|
||||
If you're in case 3., you may have a memory leak, it up to you to find it. You can try to switch to `StaticJsonBuffer` which is more efficient.
|
||||
|
||||
### The first parsing succeeds, why the next ones fail?
|
||||
|
||||
This can be due to two causes.
|
||||
|
||||
|
||||
##### Cause 1: reuse of `JsonBuffer`
|
||||
|
||||
First, this can happen if you reuse the same `JsonBuffer`, for example:
|
||||
|
||||
```c++
|
||||
StaticJsonBuffer<200> jsonBuffer;
|
||||
for (int i=0; i<10; i++) {
|
||||
char json[256];
|
||||
readJsonFromSomewhere(json, sizeof(json));
|
||||
JsonObject& root = jsonBuffer.parse(json);
|
||||
if (root.success()) {
|
||||
Serial.println("parseObject() succeeded");
|
||||
} else {
|
||||
Serial.println("parseObject() failed!");
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### What are the differences between `StaticJsonBuffer` and `DynamicJsonBuffer`?
|
||||
|
||||
| `StaticJsonBuffer` | `DynamicJsonBuffer`
|
||||
|
Reference in New Issue
Block a user