mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-08-13 17:44:49 +02:00
Updated FAQ (markdown)
20
FAQ.md
20
FAQ.md
@@ -2,6 +2,26 @@
|
|||||||
|
|
||||||
See [Compatibility issues](Compatibility issues) first.
|
See [Compatibility issues](Compatibility issues) first.
|
||||||
|
|
||||||
|
### Can I parse data from a stream?
|
||||||
|
|
||||||
|
No.
|
||||||
|
|
||||||
|
This is a fundamental design principle in this library.
|
||||||
|
The JSON input must be in memory and must be mutable (ie not readonly) to allow zero-copy and zero-allocation, which is *the* strength of this library.
|
||||||
|
|
||||||
|
To parse data from a stream, you'll have to read its content and put it in a `char[]`:
|
||||||
|
|
||||||
|
```c++
|
||||||
|
#define MAX_JSON_SIZE 256
|
||||||
|
|
||||||
|
char json[MAX_SIZE];
|
||||||
|
stream.readBytesUntil('\n', json, MAX_JSON_SIZE);
|
||||||
|
```
|
||||||
|
|
||||||
|
If this is not acceptable, you should have a look at other libraries, like [aJson](https://github.com/interactive-matter/aJson).
|
||||||
|
|
||||||
|
See issues [#60](https://github.com/bblanchon/ArduinoJson/issues/60), [#119](https://github.com/bblanchon/ArduinoJson/issues/119), [#194](https://github.com/bblanchon/ArduinoJson/issues/194), [#200](https://github.com/bblanchon/ArduinoJson/issues/200).
|
||||||
|
|
||||||
### Should I call `parseArray()` or `parseObject()`?
|
### Should I call `parseArray()` or `parseObject()`?
|
||||||
|
|
||||||
This is a very common question as people are often confused when the JSON input contains mixed arrays and objects.
|
This is a very common question as people are often confused when the JSON input contains mixed arrays and objects.
|
||||||
|
Reference in New Issue
Block a user