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

2021-06-12 Thread Alexander Dyagilev
Hello, It seems your App.result is not a js object, but a c++ object derived from QObject. Is it? On 5/28/2021 10:24 PM, Jason H wrote: I've got a really weird error: qml: type: object [DEBUG-12344567890,N] qrc:/screens/Result.qml:32: TypeError: Type error The statements are:

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

2021-06-02 Thread Jason H
> Sent: Tuesday, June 01, 2021 at 9:22 PM > From: "Tony Rietwyk" > To: interest@qt-project.org > Subject: Re: [Interest] Can't JSON.stringify an object in QML > > HI Jason, > > I'm pretty sure this is NOT valid JSON: > >{"that&q

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

2021-06-01 Thread Tony Rietwyk
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

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

2021-06-01 Thread Thorsten Glaser
On Tue, 1 Jun 2021, Jason H wrote: > > 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. No, error-tolerant behaviour just returns null in the place where the

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

2021-06-01 Thread Jason H
> 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

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

2021-05-28 Thread Thorsten Glaser
On Fri, 28 May 2021, Jason H wrote: > console.log("result:", JSON.stringify(App.result)); // this does not > qrc:/screens/Result.qml:32: TypeError: Type error My copy of ECMA-262, 5ᵗʰ edition, has JSON.stringify fail (in the “abstract operation JO”, p.205, last ordered list on the page, step 1)