JSONCodingKeys

public struct JSONCodingKeys : CodingKey

A dynamic coding key implementation that allows encoding and decoding of arbitrary JSON keys.

This structure provides flexibility when working with JSON data that contains dynamic or unknown keys at compile time, supporting both string and integer-based keys.

  • The string representation of the coding key.

    This property contains the key name as it appears in the JSON data.

    Declaration

    Swift

    public var stringValue: String
  • The integer representation of the coding key, if applicable.

    This optional property is used when the key represents an array index or other integer-based identifier in the JSON structure.

    Declaration

    Swift

    public var intValue: Int?
  • Creates a coding key from a string value.

    Declaration

    Swift

    public init?(stringValue: String)

    Parameters

    stringValue

    The string value of the key

  • Creates a coding key from an integer value.

    Declaration

    Swift

    public init?(intValue: Int)

    Parameters

    intValue

    The integer value of the key