Fix extended JSON prettification failing on escaped double-quotes

This commit is contained in:
Shadowfacts 2020-08-12 10:08:05 -04:00
parent 1ab9d53006
commit edb01fa6e2
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5
1 changed files with 2 additions and 1 deletions

View File

@ -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()
}