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

Thorsten Glaser t.glaser at tarent.de
Sat May 29 02:20:17 CEST 2021

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) with TypeError if the object is cyclical,
i.e. contains a reference to itself.

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).

Infrastrukturexperte • tarent solutions GmbH
Am Dickobskreuz 10, D-53121 Bonn • http://www.tarent.de/
Telephon +49 228 54881-393 • Fax: +49 228 54881-235
HRB AG Bonn 5168 • USt-ID (VAT): DE122264941
Geschäftsführer: Dr. Stefan Barth, Kai Ebenrett, Boris Esser, Alexander Steeg


Mit dem tarent-Newsletter nichts mehr verpassen: www.tarent.de/newsletter


More information about the Interest mailing list