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

Qt5 QJsonDocument vs QJson (sf)



  • In the past I have try (just a little) with http://qjson.sourceforge.net/usage/, I love the QJson's QObject helper that can dump and restore QObject’s attributes.

    Now In Qt5 I see the http://qt-project.org/doc/qt-5.0/qtcore/json.html but I cannot find any example!
    With the new JSON support in Qt5, can and map my "custom class" to JSON and reserve...easily like QJson?

    Can you send me some example with the new Qt5 Json, thanks!



  • qobjecthelper.h and .cpp only use core classes:
    @#include "qobjecthelper.h"

    #include <QtCore/QMetaObject>
    #include <QtCore/QMetaProperty>
    #include <QtCore/QObject>
    #include <QtCore/QString>@

    So you can do the same thing on Qt 5. Be careful , the original code is under GPL. (not LGPL-like), you can't copy/paste it and do everything with:
    @* Copyright (C) 2009 Till Adam adam@kde.org


Log in to reply