-
This JSON package is most impressive! We are thinking about using it to implement both a persistent file format, and DOM-style access to nested objects. Is there a canonical method to work with nested objects, for example: At the top level, an array of FOO, where each element contains an array of BAR, where each BAR itself contains a json object:
Clearly, I could create arrays (or stl containers) of all the FOO objects, which each contain the BAR objects, which each contain their JSON. But it might not be necessary if:
The overall (admittedly unoriginal) idea – which seems like a common pattern – is to read in the JSON from a file, use and modify the SomeJasonObject(s) at the [FOO][BAR] of our choosing (adding, deleting or modifying key/values), even possibly deleting entire sections of [FOO] or individual BAR items, then saving the whole edited JSON back out to file. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I don't fully understand your issue, so I try to answer as much as possible:
Your overall idea should be possible without any headaches with this library. |
Beta Was this translation helpful? Give feedback.
I don't fully understand your issue, so I try to answer as much as possible:
json
variablej
, thenj[FOO][BAR]
gives you a reference to the value. For arrays, you need to provide integer indices.std::vector
(for arrays) andstd::map
(for objects).Your overall idea should be possible without any headaches with this library.