34 #if QT_VERSION < 0x050000
35 #include <qjson/serializer.h>
37 #include <QJsonDocument>
55 inline QByteArray
SerializeJson (
const QVariant& var,
bool compact =
true)
57 #if QT_VERSION < 0x050000
59 s.setIndentMode (compact ?
62 return s.serialize (var);
64 return QJsonDocument::fromVariant (var)
65 .toJson (compact ? QJsonDocument::Compact : QJsonDocument::Indented);
QByteArray SerializeJson(const QVariant &var, bool compact=true)
Serializes the given var to JSON representation.