Adding JSON objects iterator
Brought to you by:
artyom-beilis
The input JSON string may be like this:
{
"JOHN" : 15,
"MARY" : 25,
"ROCKY" : 35,
"STEVE" : 45
}
Method cppcms::json::value::at() is not quite useful because we do not know the keys in advance. An objects iterator can solve this problem if it is provided.
Anonymous
Pardon my English!
Edit my original wording to make it more polite (I think):
"Method cppcms::json::value::at() is not quite useful if we do not know the keys in advance."
If objects iterator is provided by cppcms::json::value, then we can iterate the objects and inspect each element. Furthermore, we can use the iterator to convert cppcms::json::object to cppcms::json::array.
Note:
cppcms::json::object is std::map< string_key, value >
cppcms:;json::array is std::vector< value >
See: http://cppcms.com/cppcms_ref/latest/namespacecppcms_1_1json.html
You can retreive object or to array from value by calling value::object and value::array member functions.
And now you can iterate :-)
If it is what you wanted I'll close the request, otherwise explain what else you want.
Indeed!
I must have been sitting in front of my screen for too long and thus my brain starts to function poorly.
Please go ahead and close it.
Best Regards,
Not a bug