Skip to content

Commit 2b85609

Browse files
fix: nil value parsing (#161)
1 parent 26ca2e3 commit 2b85609

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Sources/Segment/Utilities/JSON.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public enum JSON: Equatable {
5151
}
5252

5353
// handle swift types
54-
case nil:
54+
case Optional<Any>.none:
5555
self = .null
5656
case let url as URL:
5757
self = .string(url.absoluteString)

Tests/Segment-Tests/JSON_Tests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class JSONTests: XCTestCase {
5353
}
5454

5555
func testJSONNil() throws {
56-
let traits = try JSON(["type": NSNull(), "preferences": ["bwack"]])
56+
let traits = try JSON(["type": NSNull(), "preferences": ["bwack"], "key": nil])
5757
let encoder = JSONEncoder()
5858
encoder.outputFormatting = .prettyPrinted
5959

0 commit comments

Comments
 (0)