NonConformingFloatDecodingStrategy
The strategy to use for non-JSON-conforming floating-point values (IEEE 754 infinity and NaN).
- iOS
- 8.0+
- macOS
- 10.10+
- tvOS
- 9.0+
- watchOS
- 2.0+
enum NonConformingFloatDecodingStrategy
The strategy to use for non-JSON-conforming floating-point values (IEEE 754 infinity and NaN).
enum NonConformingFloatDecodingStrategy
s20FoundationEssentials11JSONDecoderC34NonConformingFloatDecodingStrategyO
What are these?3T4CQ
import FoundationEssentials
class JSONDecoder
JSONDecoder
facilitates the decoding of JSON into semantic Decodable
types.
case convertFromString(positiveInfinity: String, negativeInfinity: String, nan: String)
Decode the values from the given representation strings.
case `throw`
Throw upon encountering non-conforming values. This is the default strategy.
init()
Initializes self
with default strategies.
var allowsJSON5: Bool { get set }
Set to true
to allow parsing of JSON5. Defaults to false
.
var assumesTopLevelDictionary: Bool { get set }
Set to true
to assume the data is a top level Dictionary (no surrounding “{ }” required). Defaults to false
. Compatible with both JSON5 and non-JSON5 mode.
var dataDecodingStrategy: JSONDecoder.DataDecodingStrategy { get set }
The strategy to use in decoding binary data. Defaults to .base64
.
var dateDecodingStrategy: JSONDecoder.DateDecodingStrategy { get set }
The strategy to use in decoding dates. Defaults to .deferredToDate
.
var keyDecodingStrategy: JSONDecoder.KeyDecodingStrategy { get set }
The strategy to use for decoding keys. Defaults to .useDefaultKeys
.
var nonConformingFloatDecodingStrategy: JSONDecoder.NonConformingFloatDecodingStrategy { get set }
The strategy to use in decoding non-conforming numbers. Defaults to .throw
.
var userInfo: [CodingUserInfoKey : Any] { get set }
Contextual user-provided information for use during decoding.
func decode<T>(_ type: T.Type, from data: Data) throws -> T where T : Decodable
Decodes a top-level value of the given type from the given JSON representation.
func decode<T>(_ type: T.Type, from data: Data, configuration: T.DecodingConfiguration) throws -> T where T : DecodableWithConfiguration
func decode<T, C>(_ type: T.Type, from data: Data, configuration: C.Type) throws -> T where T : DecodableWithConfiguration, C : DecodingConfigurationProviding, T.DecodingConfiguration == C.DecodingConfiguration
enum DataDecodingStrategy
The strategy to use for decoding Data
values.
enum DateDecodingStrategy
The strategy to use for decoding Date
values.
enum KeyDecodingStrategy
The strategy to use for automatically changing the value of keys before decoding.
protocol Sendable