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. Parsing JSON
Forum Updated to NodeBB v4.3 + New Features

Parsing JSON

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 602 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.
  • E Offline
    E Offline
    EverydayDiesel
    wrote on last edited by
    #1

    Does anyone know how I can just get the value "test_value"

    Input is
    {"a":"test_value"}

    The actual value that is outputted is
    QJsonValue(string, "test_value")

    I would like it to be just
    test_value

        QString val;
        val = finished->readAll();
    
        QJsonDocument doc = QJsonDocument::fromJson(val.toUtf8());
        QJsonObject jobj = doc.object();
        qDebug() << jobj.value(QString("a"));
    
    1 Reply Last reply
    0
    • T Offline
      T Offline
      TioRoy
      wrote on last edited by
      #2

      Change:

      qDebug() << jobj.value(QString("a"));

      to

      qDebug() << jobj["a"].toString();

      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