mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-09-28 16:00:55 +02:00
Updated FAQ (markdown)
28
FAQ.md
28
FAQ.md
@@ -20,6 +20,7 @@
|
|||||||
* [The first parsing succeeds, why do the next ones fail?](#the-first-parsing-succeeds-why-do-the-next-ones-fail)
|
* [The first parsing succeeds, why do the next ones fail?](#the-first-parsing-succeeds-why-do-the-next-ones-fail)
|
||||||
* [Parsing succeeds but I can't read the values!](#parsing-succeeds-but-i-cant-read-the-values)
|
* [Parsing succeeds but I can't read the values!](#parsing-succeeds-but-i-cant-read-the-values)
|
||||||
* [How to know the type of a value?](#how-to-know-the-type-of-a-value)
|
* [How to know the type of a value?](#how-to-know-the-type-of-a-value)
|
||||||
|
* [Can I access to object member by its index, instead of its key?](#can-i-access-to-object-member-by-its-index-instead-of-its-key)
|
||||||
* [How to fix error "Ambiguous overload for 'operator='"](#how-to-fix-error-ambiguous-overload-for-operator)
|
* [How to fix error "Ambiguous overload for 'operator='"](#how-to-fix-error-ambiguous-overload-for-operator)
|
||||||
|
|
||||||
|
|
||||||
@@ -654,6 +655,33 @@ array[0].is<JsonObject&>(); // return false
|
|||||||
See issues [#148](https://github.com/bblanchon/ArduinoJson/issues/148), [#175](https://github.com/bblanchon/ArduinoJson/issues/175) and [#213](https://github.com/bblanchon/ArduinoJson/issues/213).
|
See issues [#148](https://github.com/bblanchon/ArduinoJson/issues/148), [#175](https://github.com/bblanchon/ArduinoJson/issues/175) and [#213](https://github.com/bblanchon/ArduinoJson/issues/213).
|
||||||
|
|
||||||
|
|
||||||
|
### Can I access to object member by its index, instead of its key?
|
||||||
|
|
||||||
|
No.
|
||||||
|
|
||||||
|
But you can enumerate all the key-value pairs in the object, by using iterators:
|
||||||
|
|
||||||
|
```c++
|
||||||
|
char json[] = "{\"key\":\"value\"}";
|
||||||
|
JsonObject& object = jsonBuffer.parseObject(json);
|
||||||
|
|
||||||
|
for(JsonObject::iterator it=object.begin(); it!=object.end(); ++it)
|
||||||
|
{
|
||||||
|
const char* key = it->key;
|
||||||
|
|
||||||
|
if (it->value.is<char*>()) {
|
||||||
|
const char* value = it->value;
|
||||||
|
// ...
|
||||||
|
}
|
||||||
|
|
||||||
|
if (it->value.is<JsonObject>()) {
|
||||||
|
JsonObject& value = it->value;
|
||||||
|
// you can recursively traverse objects...
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
See issue [#278](https://github.com/bblanchon/ArduinoJson/issues/278).
|
||||||
|
|
||||||
### How to fix error "Ambiguous overload for 'operator='"
|
### How to fix error "Ambiguous overload for 'operator='"
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user