Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-39864

QJsonObject::value(key) returns Null instead of Undefined upon non-existing key

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Invalid
    • Icon: P2: Important P2: Important
    • None
    • 5.1.1, 5.3.0
    • None

      The Docs for QJsonObject in Qt 5 say:

      The returned QJsonValue is QJsonValue::Undefined if the key does not exist.

      However, when I do:

      QJsonObject o;
      QJsonValue foo = o["bar"];
      qDebug() << foo;

      I get:

      QJsonValue(null)

      And foo.isNull() == true and foo.isUndefined() == false

      Tested with 5.1.1 and 5.3.

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            laknoll Lars Knoll
            halfgaar Wiebe Cazemier
            Votes:
            1 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes