allowsJSON5
TypeScriptget allowsJSON5(): booleanSwift declarationvar allowsJSON5: Bool { get set }Specifies that decoding supports the JSON5 syntax. Defaults to `false`.
class · iOS 8.0+ · SDK 27.1
class JSONDecoderAn object that decodes instances of a data type from JSON objects.
get allowsJSON5(): booleanSwift declarationvar allowsJSON5: Bool { get set }Specifies that decoding supports the JSON5 syntax. Defaults to `false`.
set allowsJSON5(value: boolean)Swift declarationvar allowsJSON5: Bool { get set }Specifies that decoding supports the JSON5 syntax. Defaults to `false`.
get keyDecodingStrategy(): JSONDecoder_KeyDecodingStrategySwift declarationvar keyDecodingStrategy: JSONDecoder.KeyDecodingStrategy { get set }A value that determines how to decode a type's coding keys from JSON keys. Defaults to `.useDefaultKeys`.
set keyDecodingStrategy(value: JSONDecoder_KeyDecodingStrategy)Swift declarationvar keyDecodingStrategy: JSONDecoder.KeyDecodingStrategy { get set }A value that determines how to decode a type's coding keys from JSON keys. Defaults to `.useDefaultKeys`.
get dataDecodingStrategy(): JSONDecoder_DataDecodingStrategySwift declarationvar dataDecodingStrategy: JSONDecoder.DataDecodingStrategy { get set }The strategy that a decoder uses to decode raw data. Defaults to `.base64`.
set dataDecodingStrategy(value: JSONDecoder_DataDecodingStrategy)Swift declarationvar dataDecodingStrategy: JSONDecoder.DataDecodingStrategy { get set }The strategy that a decoder uses to decode raw data. Defaults to `.base64`.
get dateDecodingStrategy(): JSONDecoder_DateDecodingStrategySwift declarationvar dateDecodingStrategy: JSONDecoder.DateDecodingStrategy { get set }The strategy used when decoding dates from part of a JSON object.
set dateDecodingStrategy(value: JSONDecoder_DateDecodingStrategy)Swift declarationvar dateDecodingStrategy: JSONDecoder.DateDecodingStrategy { get set }The strategy used when decoding dates from part of a JSON object.
get assumesTopLevelDictionary(): booleanSwift declarationvar assumesTopLevelDictionary: Bool { get set }Specifies that decoding assumes the top level of the JSON data is a dictionary, even if it doesn't begin and end with braces. Defaults to `false`. Compatible with both JSON5 and non-JSON5 mode.
set assumesTopLevelDictionary(value: boolean)Swift declarationvar assumesTopLevelDictionary: Bool { get set }Specifies that decoding assumes the top level of the JSON data is a dictionary, even if it doesn't begin and end with braces. Defaults to `false`. Compatible with both JSON5 and non-JSON5 mode.
get nonConformingFloatDecodingStrategy(): JSONDecoder_NonConformingFloatDecodingStrategySwift declarationvar nonConformingFloatDecodingStrategy: JSONDecoder.NonConformingFloatDecodingStrategy { get set }The strategy used by a decoder when it encounters exceptional floating-point values. Defaults to `.throw`.
set nonConformingFloatDecodingStrategy(value: JSONDecoder_NonConformingFloatDecodingStrategy)Swift declarationvar nonConformingFloatDecodingStrategy: JSONDecoder.NonConformingFloatDecodingStrategy { get set }The strategy used by a decoder when it encounters exceptional floating-point values. Defaults to `.throw`.
decode(type: "Bool" | "Int" | "UInt" | "Double" | "Float" | "String" | "CGFloat" | "Date" | "URL" | "Data" | "UUID", data: ArrayBuffer): unknownSwift declarationfunc decode<T>(_ type: T.Type, from data: Data) throws -> T where T : DecodableReturns a value of the type you specify, decoded from a JSON object. - parameter type: The type of the value to decode. - parameter data: The data to decode from. - returns: A value of the requested type. - throws: `DecodingError.dataCorrupted` if values requested from the payload are corrupted, or if the given data is not valid JSON. - throws: An error if any value throws an error during decoding.
get userInfo(): NativeMap<SDKHandle, SDKHandle>Swift declaration@preconcurrency var userInfo: [CodingUserInfoKey : any Sendable] { get set }A dictionary you use to customize the decoding process by providing contextual information.
set userInfo(value: NativeMap<SDKHandle, SDKHandle>)Swift declaration@preconcurrency var userInfo: [CodingUserInfoKey : any Sendable] { get set }A dictionary you use to customize the decoding process by providing contextual information.
static init(): JSONDecoderSwift declarationinit()Creates a new, reusable JSON decoder with the default formatting settings and decoding strategies.
2 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.
JSONDecoder.decode(_:from:configuration:)
This declaration needs Swift generic type arguments. (no canonical witness for T.DecodingConfiguration)
JSONDecoder.decode(_:from:configuration:)
Passing a Swift type itself is not supported.