We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Something like this -
for ( auto i = jsonHashTable.begin(), i != jsonHashTable.end(); i++ ) { cout << "Key " << i->first; cout << "Value" << i->second; } for ( auto i = jsonArray.begin(), i != jsonArray.end(); i++ ) { cout << "Value" << *i; }
I think this will involve writing a custom iterator (see http://www.cplusplus.com/reference/iterator/) for these two classes, hopefully it isn't too difficult.
The text was updated successfully, but these errors were encountered:
The original design of the parser API doesn't allow such feature. So I implemented this feature as a part of a new API for the parser.
Old parser API:
JsonHashTable root = parser.parseHashTable(json); char* sensor = root.getString("sensor"); long time = root.getLong("time"); double latitude = root.getArray("data").getDouble(0); double longitude = root.getArray("data").getDouble(1);
New parser API:
JsonObject root = parser.parse(json); char* sensor = root["sensor"]; long time = root["time"]; double latitude = root["data"][0]; double longitude = root["data"][1];
Iterators, with C++11 syntax:
for (auto i : jsonHashTable) { cout << "Key " << i.key(); cout << "Value" << (const char*)i->value(); } for (const char* i : jsonArray) { cout << "Value" << i; }
The code is available in the new-parser-api branch
Please give me your feedback.
Sorry, something went wrong.
I merged the branch into master, it's now part of version 3.0
master
Thank you, we will upgrade to the new version soon!
bblanchon
No branches or pull requests
Something like this -
I think this will involve writing a custom iterator (see http://www.cplusplus.com/reference/iterator/) for these two classes, hopefully it isn't too difficult.
The text was updated successfully, but these errors were encountered: