33#ifndef _QX_SERIALIZE_QJSON_IX_PERSISTABLE_H_
34#define _QX_SERIALIZE_QJSON_IX_PERSISTABLE_H_
47#include <QtCore/qjsonvalue.h>
48#include <QtCore/qjsonobject.h>
49#include <QtCore/qjsonarray.h>
66 QString json = t.
toJson(format);
67 QJsonDocument doc = QJsonDocument::fromJson(json.toUtf8(), (& err));
68 if (err.error != QJsonParseError::NoError) {
return QJsonValue(); }
69 return (doc.isArray() ? QJsonValue(doc.array()) : QJsonValue(doc.object()));
78 QJsonDocument doc = (j.isArray() ? QJsonDocument(j.toArray()) : QJsonDocument(j.toObject()));
79 QString json = QString::fromUtf8(doc.toJson());
Common interface (abstract class) for persistents classes using QX_PERSISTABLE_HPP() and QX_PERSISTAB...
qx::cvt : namespace to provide global functions to convert any kind of objects to/from QString and QV...
qx::IxPersistable : common interface (abstract class) for persistents classes using QX_PERSISTABLE_HP...
virtual qx_bool fromJson(const QString &json, const QString &format=QString())=0
virtual QString toJson(const QString &format=QString()) const =0
qx_bool : boolean type with code and description message when an error occured
Root namespace for all QxOrm library features.
static qx_bool fromJson(const QJsonValue &j, qx::IxPersistable &t, const QString &format)
static QJsonValue toJson(const qx::IxPersistable &t, const QString &format)