10#include <QJsonDocument>
20 return QJsonDocument::fromVariant (
var)
21 .toJson (
compact ? QJsonDocument::Compact : QJsonDocument::Indented);
29 if (!
file.open (QIODevice::WriteOnly))
32 <<
"unable to open file"
35 <<
file.errorString ();
42 <<
"unable to write to file"
45 <<
file.errorString ();
static Either Left(const L &l)
static Either Right(R &&r)
Container< T > Filter(const Container< T > &c, F f)
SerializeResult_t SerializeJsonToFile(const QString &filename, const QVariant &var, bool compact)
QByteArray SerializeJson(const QVariant &var, bool compact)
Serializes the given var to JSON representation.