ArduinoJson
ArduinoJson copied to clipboard
deserializeJson(JsonVariant, ...)
It would be nice if the functions / methods serialzeJson() and deserializeJson() would be extended, so that it is possible to use them directly on nested Objects (and not only on the Json document).
What I mean is extra function overloadings like this:
size_t serializeJson(const JsonObject& object, char output[size]);
deserializeJson(JsonObject& object, char* input);
For my MQTT project it would be very handy, because I have to serialise a portion of a json object.
Hi @Michel-Ketelaars,
The first is already supported, you can do that for example:
serializeJson(doc["config"], configFile);
Can you detail the use case for deserializeJson(JsonObject&,...)?
Best regards, Benoit
Hi Benoit,
Thanks for your reply and good to hear that this is already supported for the serialization part.
I indeed tested only the deserializeJson() function and assumed this was also not implemented in serializeJson() function, because I did not see the particular overloaded function under Signatures. (https://arduinojson.org/v6/api/json/serializejson/)
The use case is that I receive a Json serialized message from an MQTT server with several values that I want to add or change into an existing Json opject that is afterward is completely published to a webservice.
Best regards, Michel
I want to add or change into an existing Json object
If you do this repeatedly, it will create a memory leak. How do you plan to mitigate this?
@Michel-Ketelaars, would #1343 provide an acceptable solution to your use case?
I just implemented this feature in branch 7.x.