docs/Classes/URLEncodedFormEncoder/KeyPathEncoding.html
public struct KeyPathEncoding : Sendable
Encoding to use for nested object and Encodable value key paths.
["parent" : ["child" : ["grandchild": "value"]]]
This encoding affects how the parent, child, grandchild path is encoded. Brackets are used by default. e.g. parent[child][grandchild]=value.
`
brackets
`
Encodes key paths by wrapping each component in brackets. e.g. parent[child][grandchild].
Swift
public static let brackets: URLEncodedFormEncoder.KeyPathEncoding
`
dots
`
Encodes key paths by separating each component with dots. e.g. parent.child.grandchild.
Swift
public static let dots: URLEncodedFormEncoder.KeyPathEncoding
`
init(encoding:)
`
Creates an instance with the encoding closure called for each sub-key in a key path.
Swift
public init(encoding: @escaping @Sendable (_ subkey: String) -> String)
| encoding |
Closure used to perform the encoding.
|