Qt JSON access to elements value
-
I have been exploring to parse JSON in Qt. I need to access to only few values in quite large JSON data file. In PHP there is a path like this @$json['data']['Rows'][$i]['Columns'][0]['Value']@ to get access straight to elements value. In Qt do I really have to parse every level of JSON array via QVariantMap to find deep level values?
- Kim
-
You don't need to go through QVariantMap, but API not all that fantastic either. See QJsonObject, QJsonValue, and QJsonArray for details.
However, you're not bound to only use Qt itself of course. Any C++ library will do really. So, perhaps you could look into "this":https://github.com/nlohmann/json as it seems to support a syntax very much like what you use in PHP.