I need to parse JSON object through Qt. What is the easiest/fastest way to do it?
I would recommend qjson-backport, as it uses the same API as in Qt5.
You can conditionally load the library when you use Qt4, and use the default implementation when using Qt5.
My qjson.pri file looks like:
!greaterThan(QT_MAJOR_VERSION, 4): {
INCLUDEPATH += \
$$PWD
SOURCES += \
$$PWD/qjson.cpp \
$$PWD/qjsonarray.cpp \
$$PWD/qjsondocument.cpp \
$$PWD/qjsonobject.cpp \
$$PWD/qjsonparser.cpp \
$$PWD/qjsonvalue.cpp \
$$PWD/qjsonwriter.cpp
HEADERS += \
$$PWD/qjson_p.h \
$$PWD/qjsonarray.h \
$$PWD/qjsondocument.h \
$$PWD/qjsonobject.h \
$$PWD/qjsonparser_p.h \
$$PWD/qjsonvalue.h \
$$PWD/qjsonwriter_p.h
}