EnumerationFoundation5.9.0
KeyDecodingStrategy
The strategy to use for automatically changing the value of keys before decoding.
enum KeyDecodingStrategy
Citizens in Foundation
Members
case convertFromSnakeCase
Convert from “snake_case_keys” to “camelCaseKeys” before attempting to match a key with the one specified by each type.
case custom(([CodingKey]) -> CodingKey)
Provide a custom conversion from the key in the encoded JSON to the keys specified by the decoded types. The full path to the current decoding position is provided for context (in case you need to locate this key within the payload). The returned key is used in place of the last component in the coding path before decoding. If the result of the conversion is a duplicate key, then only one value will be present in the container for the type to decode from.
case useDefaultKeys
Use the keys specified by each type. This is the default strategy.