Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QJsonObject.insert("long-name") creates truncated key. How can I get around this?



  • I have a QJsonObject that already has a key

    "data-source-storages"
    

    I use the following statement to replace the value connected to that key:

    obj.insert("data-source-storages", dataSourceStorages);
    

    After this statement has executed the debugger shows that the QJsonObject now has a key with the truncated name

    "data-sourc"
    

    instead of

    "data-source-storages"
    

    Why is this happening? How can I replace a value without clipping the key?


  • Moderators

    Sounds like a bug. Which Qt version are you using? What operating system? Can you try some other long string - is behaviour the same?


  • Qt Champions 2019

    @pokemonsrqt I doubt the key is really truncated, I guess it is simply the dubugger showing it this way for some reason.
    Did you try to print out the Json string?



  • I'm using macOS 10.13.6, Qt Creator 4.7.2 and Qt 5.11.2.

    The application works, so it seems that it is only the debugger showing the wrong value as @jsulm figured. I won't pursue this issue any further.


Log in to reply