On 17/05/16 08:24, Larry Martell wrote:
I've see a lot of code that does something like this:
QJsonDocument document = QJsonDocument::fromJson(jsonData);
QJsonObject object = document.object();
QJsonValue value = object.value("capData");
But I don't want to hard code the keys - I want to pick up and store
whatever happens to be in the JSON file. How can I iterate through it
and do that?
Also, what would be the best object to store this in so I can later
access it as I want to?
QJsonObject has iterator methods, and for each value you can check if it
is itself an array or an object or a simple type (QJsonValue::isArray(),
isObject(), isString() etc).
As for another object, I can't think of another with this flexibility.
Why not leave it in the QJson* objects?
Hamish
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest