I kind of feel stupid for asking this, but haven't been able to find a way to get the key of a JSON value. I know how to retrieve the key if I have an iterator of the object. I also know of operator[]
.
In my case the key is not a known value, so can't use get(const char *key)
or operator[]
. Also can't find a getKey()
method.
My JSON looks like this:
{Obj_Array: [{"122":{"Member_Array":["241", "642"]}}]}
For the piece of code to parse {"122":{"Member_Array":["241", "642"]}}
I want to use get_key()
-like function just to retrieve "122"
but seems like I have to use an iterator which to me seems to be overkill.
I might have a fundamental lack of understanding of how jsoncpp
is representing a JSON file.