Skip to content
/ RBBJSON Public

Commit 0a6cb16

Browse files
committed
Don't escape slashes when writing to disk
1 parent 24a9157 commit 0a6cb16

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

Sources/RBBJSON/IO/JSON+File.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ public extension JSON {
1414

1515
try FileManager.default.createDirectory(at: url.deletingLastPathComponent(), withIntermediateDirectories: true)
1616

17-
try JSONEncoder().encode(json).write(to: url)
17+
var encoder = JSONEncoder()
18+
encoder.outputFormatting = [.sortedKeys, .prettyPrinted, .withoutEscapingSlashes]
19+
20+
try encoder.encode(json).write(to: url)
1821
}
1922
}

0 commit comments

Comments
 (0)