Question

{
    "80550560": {"name":" HAdailton Cesar", "name2": "T-Max"},
    "5987810": {"name": "Adnax", "name2": "Adna Zaza"}
}

I have this input and I need to output all the names that comes in the input, but the problem is that i don't have integer organized index, I would have to get the string number and also I don't know what the string text index is going to be.

I would imagine something like this, but I don't know how to get the 'string_text' from JsonCPP

res[string_text]["name"];
Was it helpful?

Solution

Use getMemberNames to get a list.

I'm pretty sure it is possible to iterate through too, but I have always opted to use `getMemberNames'

OTHER TIPS

Reading the documentation for the Json::Value class, it have iterator capabilities like begin and end, so it should be possible to iterate the values like a standard container.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top