mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-08-18 12:01:32 +02:00
Updated FAQ (markdown)
28
FAQ.md
28
FAQ.md
@@ -277,7 +277,33 @@ void sendJson(JsonVariant json) {
|
||||
}
|
||||
```
|
||||
|
||||
See issue [#195](https://github.com/bblanchon/ArduinoJson/issues/195)
|
||||
But in that case, you loose some specificities of the `JsonObject` class.
|
||||
In particular, you don't have the `containsKey()` method.
|
||||
If you need this function, you must cast the `JsonVariant` back to a `JsonObject&`.
|
||||
|
||||
For instance:
|
||||
|
||||
```c++
|
||||
void myFunction(JsonVariant variant)
|
||||
{
|
||||
if (variant.is<JsonArray&>())
|
||||
{
|
||||
JsonArray& array = variant;
|
||||
// ...
|
||||
}
|
||||
else if (variant.is<JsonObject&>())
|
||||
{
|
||||
JsonObject& object = variant;
|
||||
// ...
|
||||
}
|
||||
else
|
||||
{
|
||||
// ...
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
See issue [#195](https://github.com/bblanchon/ArduinoJson/issues/195) and [#196](https://github.com/bblanchon/ArduinoJson/issues/196)
|
||||
|
||||
### What are the differences between `StaticJsonBuffer` and `DynamicJsonBuffer`?
|
||||
|
||||
|
Reference in New Issue
Block a user