Hi i am using the library JsonparseGeneratorRK to generate the JSON format and share my data on cloud. I use jw.insertkeyvalue(“data”, “hello”) to have something like
“data”: “hello”
However I need to create a nested structure like:
“data:” {
“Sentence”: " hello"
}
How can I create a nested structure using this library? Can someonw provide an example?
Sticking with one example would prevent additional confusion
As to your original request, this is how you'd do it
JsonWriterStatic<256> jw;
JsonWriterAutoObject obj(&jw);
jw.insertKeyObject("data"); // create the key/value(object)
jw.insertKeyValue("Sentence", "hello"); // add the key/value(string) to that open object
jw.finishObjectOrArray(); // close the object
BTW
You shouldn't have a colon in your key there. While it's not forbidden, it's not best style either
The JSON string would look like this