30 lines
865 B
C++
30 lines
865 B
C++
#ifndef JSONPARSER_H
|
|
#define JSONPARSER_H
|
|
|
|
#include <QVariant>
|
|
|
|
class QJsonObject;
|
|
class QString;
|
|
class QByteArray;
|
|
class QJsonArray;
|
|
|
|
using namespace std;
|
|
|
|
class JsonParser {
|
|
public:
|
|
static QList<QHash<int, QVariant>> toItemValuesList(const QByteArray& jsonData,
|
|
const QString& objectName = "");
|
|
static QByteArray itemValuesListToJson(const QList<QHash<int, QVariant>>& itemValuesList,
|
|
const QString& objectName = "");
|
|
|
|
private:
|
|
explicit JsonParser();
|
|
|
|
static QJsonArray extractItemArray(const QByteArray& jsonData, const QString& objectName);
|
|
static QHash<int, QVariant> jsonObjectToItemValues(const QJsonObject& itemJsonObject);
|
|
|
|
static pair<int, QVariant> getKeyValuePair(const QJsonObject& itemJsonObject, const int role);
|
|
};
|
|
|
|
#endif // JSONPARSER_H
|