[Interest] Can't JSON.stringify an object in QML

Jason H jhihn at gmx.com
Tue Jun 1 16:29:03 CEST 2021


> Some JSON serialisers replace that with null nowadays.
> 
> I guess you could write some code to test whether it’s cyclical
> and at which elements it recurses. If you feel not up to it,
> write back and I’ll try (ECMAscript is not a language I feel
> comfortable in either but I think I could manage).


Well, if it were cyclical (I really don't think it is),  I would expect that the line: 
return QJsonDocument::fromVariant(v).toJson(QJsonDocument::Compact);

Would never return. However it does, and it gives me the exact string I would expect.
So I'm still at a loss there.


The object does contain an empty object, could that be it? For example:
{"that": "other": {} }






More information about the Interest mailing list