Important: Please read the Qt Code of Conduct -

Parsing JSON

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

    Input is

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

    I would like it to be just

        QString val;
        val = finished->readAll();
        QJsonDocument doc = QJsonDocument::fromJson(val.toUtf8());
        QJsonObject jobj = doc.object();
        qDebug() << jobj.value(QString("a"));

  • Change:

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


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

Log in to reply