14#include <QJsonDocument>
22 template<
typename,
typename>
30 explicit UnexpectedJson (QJsonValue::Type expected,
const QJsonValue&);
31 explicit UnexpectedJson (QJsonValue::Type expected,
const QJsonDocument&);
34 template<QJsonValue::Type Expected>
40 if constexpr (
Expected == QJsonValue::Array)
41 return value.toArray ();
42 if constexpr (
Expected == QJsonValue::Object)
43 return value.toObject ();
44 if constexpr (
Expected == QJsonValue::String)
45 return value.toString ();
46 if constexpr (
Expected == QJsonValue::Double)
47 return value.toDouble ();
48 if constexpr (
Expected == QJsonValue::Bool)
49 return value.toBool ();
52 template<QJsonValue::Type Expected>
56 if constexpr (
Expected == QJsonValue::Object)
61 else if constexpr (
Expected == QJsonValue::Array)
Container< T > Filter(const Container< T > &c, F f)
auto As(const QJsonValue &value)
Either< QString, QJsonDocument > ToJson(const QByteArray &json)