From 5c2b9cb10b12e40e8c69f9f0fb3ab82f46ab689b Mon Sep 17 00:00:00 2001 From: GriffinR Date: Sun, 8 Jun 2025 17:54:22 -0400 Subject: [PATCH] Restore some JSON character escapes --- src/lib/orderedjson.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lib/orderedjson.cpp b/src/lib/orderedjson.cpp index ed7e1d8a..cd92c7aa 100644 --- a/src/lib/orderedjson.cpp +++ b/src/lib/orderedjson.cpp @@ -77,7 +77,11 @@ static void dump(bool value, QString &out, int *indent) { static void dump(const QString &value, QString &out, int *indent, bool isKey = false) { if (!isKey && !out.endsWith(": ")) out += QString(*indent * 2, ' '); - out += QString("\"%1\"").arg(value.toUtf8()); + + // Convert QString to a JSON-ready string using Qt's internal conversion. + // We use 'mid' and 'chopped' to remove the JSON array's '[' and ']' characters. + auto doc = QJsonDocument(QJsonArray() << value); + out += doc.toJson(QJsonDocument::Compact).mid(1).chopped(1); } static void dump(const Json::array &values, QString &out, int *indent) {