swift-json-gen
swift-json-gen copied to clipboard
Handle unparsable dictionaries better
Only [String: *]
dicts are supported by JsonGen, since a Json dictionary key always is a string. I tried to outsmart JsonGen by creating this:
enum MyKey: String {
case SomeKey = "SomeKey"
}
struct MyJsonStruct {
let someDict: [MyKey: OtherJsonStruct]
}
JsonGen gave me the impression that it could work because the Dictionary.decodeJson
method takes a key decoder that is somewhat generic. But it really only will work with String
keys because of the direct case to [Key: Value]
that JsonGen performs, maybe this is something that could be a little stricter.