ExtendedJSONEncoder
public class ExtendedJSONEncoder
Facilitates the encoding of Encodable values into ExtendedJSON.
-
A struct representing the supported string formats based on the JSON standard that describe how to represent BSON documents in JSON using standard JSON types and/or type wrapper objects.
See moreDeclaration
Swift
public struct Format -
Determines whether to encode to canonical or relaxed extended JSON. Default is relaxed.
Declaration
Swift
public var format: Format -
Contextual user-provided information for use during encoding.
Declaration
Swift
public var userInfo: [CodingUserInfoKey : Any] -
Initialize an
ExtendedJSONEncoder.Declaration
Swift
public init() -
Encodes an instance of the Encodable Type
Tinto Data representing canonical or relaxed extended JSON. The value ofself.formatwill determine which format is used. If it is not set explicitly, relaxed will be used.Throws
EncodingErrorif the value is corrupt or cannot be converted to valid ExtendedJSON.Declaration
Swift
public func encode<T>(_ value: T) throws -> Data where T : EncodableParameters
valueinstance of Encodable type
Twhich will be encoded.Return Value
Encoded representation of the
Tinput as an instance ofDatarepresenting ExtendedJSON. -
Encodes an instance of the Encodable Type
Tinto aByteBufferrepresenting canonical or relaxed extended JSON. The value ofself.formatwill determine which format is used. If it is not set explicitly, relaxed will be used.Throws
EncodingErrorif the value is corrupt or cannot be converted to valid ExtendedJSON.Declaration
Swift
public func encodeBuffer<T>(_ value: T) throws -> ByteBuffer where T : EncodableParameters
valueinstance of Encodable type
Twhich will be encoded.Return Value
Encoded representation of the
Tinput as an instance ofByteBufferrepresenting ExtendedJSON.
View on GitHub
Install in Dash
ExtendedJSONEncoder Class Reference