Skip to content

Commit 05803d6

Browse files
authored
Switch to using JSONEncoder.makeWithDefaults() for the JSON output formatting, now that it exists. No change in semantics, so no change to tests. (#3087)
1 parent c68fd5b commit 05803d6

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

Sources/Commands/Describe.swift

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,8 @@ func describe(_ package: Package, in mode: DescribeMode, on stream: OutputByteSt
2727
let data: Data
2828
switch mode {
2929
case .json:
30-
let encoder = JSONEncoder()
30+
let encoder = JSONEncoder.makeWithDefaults()
3131
encoder.keyEncodingStrategy = .convertToSnakeCase
32-
// FIXME: This should be extracted into somewhere reusable.
33-
if #available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *) {
34-
encoder.outputFormatting = [.sortedKeys, .prettyPrinted, .withoutEscapingSlashes]
35-
}
36-
else if #available(macOS 10.13, iOS 11.0, watchOS 4.0, tvOS 11.0, *) {
37-
encoder.outputFormatting = [.sortedKeys, .prettyPrinted]
38-
}
39-
else {
40-
encoder.outputFormatting = [.prettyPrinted]
41-
}
4232
data = try! encoder.encode(desc)
4333
case .text:
4434
var encoder = PlainTextEncoder()

0 commit comments

Comments
 (0)