Enumeration

JSONEncoder.KeyEncodingStrategy

The values that determine how a type's coding keys are encoded as JSON keys.

Declaration

enum JSONEncoder.KeyEncodingStrategy

Overview

Topics

Built-in Encoding

case convertToSnakeCase

A key encoding strategy that converts camel-case keys to snake-case keys.

case useDefaultKeys

A key encoding strategy that doesn't change key names during encoding.

Custom Encoding

case custom(([CodingKey]) -> CodingKey)

A key encoding strategy defined by the closure you supply.

See Also

Customizing Encoding

var outputFormatting: JSONEncoder.OutputFormatting

A value that determines the readability, size, and element order of the encoded JSON object.

struct JSONEncoder.OutputFormatting

The output formatting options that determine the readability, size, and element order of an encoded JSON object.

var keyEncodingStrategy: JSONEncoder.KeyEncodingStrategy

A value that determines how a type's coding keys are encoded as JSON keys.

var userInfo: [CodingUserInfoKey : Any]

A dictionary you use to customize the encoding process by providing contextual information.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software