Updated FAQ (markdown)

Benoît Blanchon
2016-01-19 10:10:28 +01:00
parent 8a46910601
commit 607210b6ae

11
FAQ.md

@@ -9,6 +9,17 @@ 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.
Let's see an example to understand why this is important:
```c++
char json[] = "{\"hello\":\"world\"}";
JsonObject& root = jsonBuffer.parseObject(json);
const char* world = root["hello"];
```
After executing the lines above, the variable `world` will point to the word `"world"` inside the `json` string. During the call to `parseObject()`, the `json` string has been modified to insert the necessary zero-terminator (`\0`), to cut the string `world`.
As you can see this process requires neither duplication nor allocation, but imposes the input to be stored in a `char[]`.
To parse data from a stream, you'll have to read its content and put it in a `char[]`:
```c++