JSON.parse reports error, even despite proper parsing



  • I have a very simple, short JSON piece that validates fine with online validators. When I use JSON.parse in my QML, it parses correctly and I am able to use the values just fine. However, the console logs:

    @JSON.parse: Parse error@

    Why would Qt Quick (5.2) indicate erroneous parsing when the parsing is in fact happening, and the JSON is valid anyway?

    The JSON is simply this:

    @{
    "files": ["gun","tree","1"],
    "repeat": true,
    "fps": 25
    }@



  • Turns out this was because I was using an XMLHttpRequest for the parse data, and should have checked that the XMLHttpRequest was in a finished state before attempting to parse; eventually, it would parse correctly, but intermediate states would cause the parsing to occur on incomplete data.


Log in to reply
 

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