From edb01fa6e284a9cb601abacbaeeeabfd30b4edad Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Wed, 12 Aug 2020 10:08:05 -0400 Subject: [PATCH] Fix extended JSON prettification failing on escaped double-quotes --- MongoView/ExtendedJSON.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MongoView/ExtendedJSON.swift b/MongoView/ExtendedJSON.swift index 4fbb034..7679858 100644 --- a/MongoView/ExtendedJSON.swift +++ b/MongoView/ExtendedJSON.swift @@ -45,7 +45,8 @@ struct ExtendedJSON { } static func prettify(_ string: String) -> String? { - let command = "JSON.stringify(JSON.parse(`\(string)`), null, 4)" + context.setObject(string, forKeyedSubscript: "value" as NSString) + let command = "JSON.stringify(JSON.parse(value), null, 4)" return context.evaluateScript(command)?.toString() }