(Qt5) JSON.stringify call Error. Error message is "Converting circular structure to JSON"



  • Anybody can help me?
    @main.qml

    import QtQuick 2.0
    import QtQuick.Controls 1.0
    import QtQuick.Layouts 1.0
    Rectangle {
    Button{
    id: testButton
    text:"Test"
    }
    Text{
    id: testText
    text:"TEST"
    }

    Component.onCompleted: {
        console.log("JSON data = " + JSON.stringify(testText));   //It's OK
        console.log("JSON data = " + JSON.stringify(testButton)); //Get an error "TypeError: Converting circular structure to JSON"
    }
    

    }@


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.