-
-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
Hello! When using JSONEncoder, dictionary types that are optional are not correctly encoded by Skip.
struct TestEntity2: Codable {
let optionalDict: [String: String]?
let nonOptionalDict: [String: String]
}
// This succeeds ✅
try! JSONEncoder().encode(TestEntity2(optionalDict: nil, nonOptionalDict: [:]))
// This fails ❌ data error skip.lib.ErrorException: java.lang.ClassCastException: skip.lib.Tuple2 cannot be cast to skip.lib.Encodable
try! JSONEncoder().encode(TestEntity2(optionalDict: ["1": "abc"], nonOptionalDict: ["1": "abc"]))
I'm currently working around by using a non optional dict and making it empty to represent nil.
Thank you!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels