Remove ensure JSON helpers

Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
This commit is contained in:
TheKodeToad
2025-11-09 18:30:07 +00:00
parent 7e8cf628e8
commit e42c9d2a1d
38 changed files with 228 additions and 239 deletions

View File

@@ -153,7 +153,7 @@ QJsonValue toJson<QVariant>(const QVariant& variant)
template <>
QByteArray requireIsType<QByteArray>(const QJsonValue& value, const QString& what)
{
const QString string = ensureIsType<QString>(value, what);
const QString string = value.toString(what);
// ensure that the string can be safely cast to Latin1
if (string != QString::fromLatin1(string.toLatin1())) {
throw JsonException(what + " is not encodable as Latin1");
@@ -221,7 +221,7 @@ QDateTime requireIsType<QDateTime>(const QJsonValue& value, const QString& what)
template <>
QUrl requireIsType<QUrl>(const QJsonValue& value, const QString& what)
{
const QString string = ensureIsType<QString>(value, what);
const QString string = value.toString(what);
if (string.isEmpty()) {
return QUrl();
}