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

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

    XMLWordPrintable

Details

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

    Description

      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.

      Attachments

        For Gerrit Dashboard: QTBUG-39864
        # Subject Branch Project Status CR V

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes