Fix extended JSON prettification failing on escaped double-quotes
This commit is contained in:
parent
1ab9d53006
commit
edb01fa6e2
|
@ -45,7 +45,8 @@ struct ExtendedJSON {
|
||||||
}
|
}
|
||||||
|
|
||||||
static func prettify(_ string: String) -> String? {
|
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()
|
return context.evaluateScript(command)?.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue