Details
-
Bug
-
Resolution: Out of scope
-
Not Evaluated
-
None
-
5.13.2, 5.14.0 Beta2
-
None
Description
The following code produces different results on Linux and macOS:
#include <QDebug> #include <QJsonArray> #include <QJsonDocument> #include <QJsonObject> int main() { QJsonDocument doc = QJsonDocument::fromJson("{ \"rooms\": [ 1 ] }"); QJsonObject obj = doc.object(); // macOS: QJsonArray([1]) // linux: QJsonArray([[1]]) qDebug() << QJsonArray { obj["rooms"].toArray() }; // both macOS and Linux: QJsonArray([1]) qDebug() << QJsonArray (obj["rooms"].toArray() ); return 0; }
As in the comments, on Linux, the first constructor form for QJsonArray produces [[1]], while on macOS it produces [1]. In my opinion, the correct behaviour is the one from macOS.
Nevertheless, even if you consider the correct behaviour to be the one on Linux (aka return [[1]] for the first constructor form), the same array should be returned on both macOS and Linux.