[Interest] QJsonObject::value() - Undefined or Null upon non-existing key

Wiebe Cazemier wiebe at halfgaar.net
Wed Jun 25 14:31:49 CEST 2014


Hi,

The docs for QJsonObject::operator[] say [1]:

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

Yet:

==
QJsonValue var = responseVariables["IDontExist"];
var.isUndefined() -> false;
var.isNull() -> true;

qDebug() << var;
QJsonValue(null)
==

I use Qt 5.1.1.

Regards,

Wiebe Cazemier



[1] http://qt-project.org/doc/qt-5/qjsonobject.html#operator-5b-5d



More information about the Interest mailing list