diff --git a/MongoView/JSONPrettyPrinter.swift b/MongoView/JSONPrettyPrinter.swift index f9b42dc..7ed2b18 100644 --- a/MongoView/JSONPrettyPrinter.swift +++ b/MongoView/JSONPrettyPrinter.swift @@ -89,7 +89,23 @@ class JSONPrettyPrinter { } private func escape(_ str: String) -> String { - return str.replacingOccurrences(of: "\"", with: "\\\"") + var str = str + var index = str.startIndex + while index < str.endIndex { + let c = str[index] + if c == "\\" || c == "\"" { + str.replaceSubrange(index..