11 #if QT_VERSION > 0x050000 12 #include <QJsonObject> 13 #include <QJsonParseError> 15 #include <qjson/parser.h> 16 #include <qjson/serializer.h> 23 #if QT_VERSION > 0x050000 24 QByteArray
json = QJsonDocument::fromVariant(
data).toJson(QJsonDocument::Compact);
30 QJson::Serializer serializer;
32 QByteArray
json = serializer.serialize(
data);
34 QByteArray
json = serializer.serialize(
data, &ok);
37 qDebug() << QString(
"Sorry, there is a problem with data serializing in JSON::json()");
46 #if QT_VERSION > 0x050000 47 QJsonParseError error;
48 QJsonDocument jdoc = QJsonDocument::fromJson(
json, &error);
49 return jdoc.toVariant();
53 return parser.parse(
json, &ok);
static QVariant data(const QByteArray &json)
Converts json to data.
static QByteArray json(const QVariant &data)
Converts data to json.