- Fixed throwing issue
- Migrated to Swift 5
- Migrated to Swift 4
- Decoded typed dictionaries now filter out invalid objects by default instead of failing the whole response. This aligns with the defaults of how arrays are decoded.
- Typed dictionaries and array functions now allow for specifiying the behaviour of when a child item encounters an error. See InvalidItemBehaviour for more details. The default is to remove these child items with
.remove
- DecodingError has been restructured, so that every error provides:
- dictionary
- keypath
- expectedType
- value
- optional array if the error occured within an array
- Each DecodingError type has also been moved into a simple reason enum. JSONPrimitiveConvertibleError has also been merged into DecodingError, which now as the following error reasons:
- keyNotFound
- incorrectRawRepresentableRawValue
- incorrectType
- conversionFailure
[String: RawRepresentable]
can be now be decoded
Thanks to Yonas Kolb
- This adds support for decoding typed dictionaries with a String key, specifically:
[String: JSONRawType]
[String: JSONObjectConvertible]
[String: JSONPrimitiveConvertible]
Thanks to Yonas Kolb
- Added support for
URL
decoding out of the box thanks to Sam Dods
- Support for Swift 3
- Keypath access in JSON dictionaries
- Renamed function for accessing values
jsonKey(_:)
tojson(atKeyPath:)
- Renamed
Transformable
protocol toJSONPrimitiveConvertible
- Renamed
Decodable
protocol toJSONObjectConvertible
- Renamed JSONDictionary loading functions:
fromFile(_:)
tofrom(filename:)
fromData(_:)
tofrom(jsonData:)
- Added suppport for decoding arrays of
RawRepresentable
enums, i.e.[RawRepresentable]
- Added suppport for
RawRepresentable
enums thanks to Yonas Kolb
- Added support for decoding an array of
Tranformable
values
- Added support for decoding a raw JSON dictionary and an array of raw JSON dictionary, i.e.
[String : AnyObject]
and[[String : AnyObject]]
- Added
Tranformable
protocol to support decoding for custom types
- Renamed
MandatoryLiteral
enum inDecodingError
toMandatoryKeyNotFound
for clarity
- API now uses a functional approach.
JSONDecoder
class and its associated methods have been replaced by anextension
onDictionary
. The JSON key is now decoded by calling thejsonKey(_:)
function. e.g.:
let jsonDictionary = [
"key": "value",
"key2": "value2"
]
let myStringValue : String? = jsonDictionary.jsonKey("key")
print(myStringValue) // "Optional("value")\n"