[Interest] Can't JSON.stringify an object in QML
Tony Rietwyk
tony at rightsoft.com.au
Wed Jun 2 03:22:45 CEST 2021
HI Jason,
I'm pretty sure this is NOT valid JSON:
{"that": "other": {} }
Either the value and comma for "that" is missing, or "other": {} should
be encapsulated as an object in braces as the value of "that".
Regards, Tony
On 2/06/2021 12:29 am, Jason H wrote:
>> 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": {} }
>
>
>
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> https://lists.qt-project.org/listinfo/interest
More information about the Interest
mailing list