#ifndef JSONPARSER_H #define JSONPARSER_H #include class QJsonObject; class QString; class QByteArray; class QJsonArray; typedef QMap ModelItemValues; using namespace std; class JsonParser { public: static QList toItemValuesList(const QByteArray& jsonData, const QString& rootValueName = ""); static QByteArray itemValuesListToJson(const QList& itemValuesList, const QString& objectName = ""); static QJsonObject itemValuesToJsonObject(const ModelItemValues& itemValues); private: explicit JsonParser(); static QJsonArray extractItemArray(const QJsonDocument& doc, const QString& objectName); static ModelItemValues jsonObjectToItemValues(const QJsonObject& itemJsonObject); static pair getKeyValuePair(const QJsonObject& itemJsonObject, const int role); static QJsonValue extractJsonValue(const ModelItemValues& itemValues, const int role); }; #endif // JSONPARSER_H