0

I am using the jsoncpp library to parse and create json structures. Is it possible to convert following syntax

    jsonText["name1"]["name2"] = "Testmessage";

into something like this

    jsonText["name1.name2"] = "Testmessage";

so that

    jsonText["name1"]["name2"] = jsonText["name1.name2"];

Regards

user3263577
  • 11
  • 1
  • 3
  • Supposed this isn't possible, why do you want to do this? – πάντα ῥεῖ Jun 22 '14 at 08:45
  • Do you want to modify the library to do this? That would be a bad idea since any legitimate `name1.name2` collides with `["name1"]["name2"]`. That said, you can do this manually. Parse it like normal and iterate through each subarray (i.e. `jsonText[key1]`) and convert all of those keys to `key1.key2` and add it to the top-level of your structure. – RageD Jun 22 '14 at 13:47

0 Answers0