mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-08-13 17:44:49 +02:00
Updated FAQ (markdown)
18
FAQ.md
18
FAQ.md
@@ -14,6 +14,24 @@ 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.
|
||||
|
||||
Also, if the input string is constant, the `JsonBuffer` will have to make a copy of it.
|
||||
|
||||
```c++
|
||||
// case 1: char array => no duplication => good
|
||||
char[] json = "{\"hello\":\"world\"}";
|
||||
jsonBuffer.parseObject(json);
|
||||
|
||||
// case 2: const char* => duplication => bad
|
||||
const char* json = "{\"hello\":\"world\"}";
|
||||
jsonBuffer.parseObject(json);
|
||||
|
||||
// case 3: String => duplication => bad
|
||||
String json = "{\"hello\":\"world\"}";
|
||||
jsonBuffer.parseObject(json);
|
||||
```
|
||||
|
||||
To avoid any duplication, make sure you use an input of type `char*` or `char[]`
|
||||
|
||||
### The first parsing succeeds, why does the next ones fail?
|
||||
|
||||
This can be due to two causes.
|
||||
|
Reference in New Issue
Block a user