Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
6.6
-
None
Description
Hello,
The bug in short is very simple:
consider a QObject "foo" with a
QVector<QString> bar{"a", "b", "c"};
property exposed to QML.
console.log(JSON.stringify(foo.bar))
gives
[ 'a', 'b', 'c' ]
as expected.
- passing the object to a C++ slot that takes in argument a QJsonObject from QML, e.g.:
backend.toJson(foo.bar)
gives on the other hand the following JSON structure:
{ "0": "a", "1": "b", "2": "c" }
e.g. the array gets transformed into a map, with each index being a key.
This is a somewhat surprising and confusing behaviour. It happens of course recursively, e.g. I'm passing a root object that contains at some point a child, child, child member of this type which gets incorrectly converted.
Attached: full repro