Details
-
Bug
-
Resolution: Invalid
-
Not Evaluated
-
None
-
5.10.0
-
None
-
Qt 5.10.0, MSVC 2017 x64, Windows 10 x64
Description
If a QJsonArray contains another QJsonArray, we should expect that the only element within the outermost array is an empty array. However, this is not the case. The value within the outermost array seems to be an undefined QJsonValue. Meanwhile, if the outermost QJsonArray contains multiple items, all items within the outermost array are treated (correctly) as arrays.
#include <QDebug> #include <QJsonArray> int main(int argc, char *argv[]) { QJsonArray arr({QJsonArray()}); QJsonArray arr2({QJsonArray(), QJsonArray()}); qDebug() << arr.first(); // We get QJsonValue(undefined) qDebug() << arr.first().isArray(); // false qDebug() << arr2.first(); // We get the expected QJsonValue(array, QJsonArray([])) qDebug() << arr2.first().isArray(); // true