Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt JSON access to elements value
Forum Updated to NodeBB v4.3 + New Features

Qt JSON access to elements value

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 892 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kiwimess
    wrote on last edited by
    #1

    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
    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved