SwiftclassFoundation

class Foundation.JSONEncoder

Structure

What a query’s scopes step through. Every node here can be matched — see the syntax.

inherits{}

Members 14

  1. deinitdeinit
  2. fieldvar options: Foundation.JSONEncoder._Options+0x10
  3. fieldlet optionsLock: Synchronization.Mutex<()>
  4. funcencode<A where A: Encodable>(A) throws -> Foundation.Data
  5. funcencode<A where A: Foundation.EncodableWithConfiguration>(_: A, configuration: A.EncodingConfiguration) throws -> Foundation.Data
  6. funcencode<A, B where A: Foundation.EncodableWithConfiguration, B: Foundation.EncodingConfigurationProviding, A.EncodingConfiguration == B.EncodingConfiguration>(_: A, configuration: B.Type) throws -> Foundation.Data
  7. initFoundation.JSONEncoder.__allocating_init() -> Foundation.JSONEncoder
  8. typealiastypealias Output = Foundation.Data
  9. varvar dataEncodingStrategy: Foundation.JSONEncoder.DataEncodingStrategy { get set }
  10. varvar dateEncodingStrategy: Foundation.JSONEncoder.DateEncodingStrategy { get set }
  11. varvar keyEncodingStrategy: Foundation.JSONEncoder.KeyEncodingStrategy { get set }
  12. varvar nonConformingFloatEncodingStrategy: Foundation.JSONEncoder.NonConformingFloatEncodingStrategy { get set }
  13. varvar outputFormatting: Foundation.JSONEncoder.OutputFormatting { get set }
  14. varvar userInfo: [CodingUserInfoKey : Any] { get set }
@_objcRuntimeName(_TtC10Foundation13__JSONEncoder)
class JSONEncoder {
    struct OutputFormatting {
        let rawValue: Swift.UInt

        static var prettyPrinted: Foundation.JSONEncoder.OutputFormatting {
            get
        }
        static var sortedKeys: Foundation.JSONEncoder.OutputFormatting {
            get
        }
        static var withoutEscapingSlashes: Foundation.JSONEncoder.OutputFormatting {
            get
        }
    }
    enum DateEncodingStrategy {
        case formatted(__C.NSDateFormatter)
        case custom(@Sendable (Foundation.Date, any Swift.Encoder) throws -> ())
        case deferredToDate
        case secondsSince1970
        case millisecondsSince1970
        case iso8601
    }
    enum DataEncodingStrategy {
        case custom(@Sendable (Foundation.Data, any Swift.Encoder) throws -> ())
        case deferredToData
        case base64
    }
    enum NonConformingFloatEncodingStrategy {
        case convertToString(positiveInfinity: Swift.String, negativeInfinity: Swift.String, nan: Swift.String)
        case throw
    }
    enum KeyEncodingStrategy {
        case custom(@Sendable (_: [any Swift.CodingKey]) -> any Swift.CodingKey)
        case useDefaultKeys
        case convertToSnakeCase
    }
    struct _Options {
        var outputFormatting: Foundation.JSONEncoder.OutputFormatting
        var dateEncodingStrategy: Foundation.JSONEncoder.DateEncodingStrategy
        var dataEncodingStrategy: Foundation.JSONEncoder.DataEncodingStrategy
        var nonConformingFloatEncodingStrategy: Foundation.JSONEncoder.NonConformingFloatEncodingStrategy
        var keyEncodingStrategy: Foundation.JSONEncoder.KeyEncodingStrategy
        var userInfo: [Swift.CodingUserInfoKey : Any]
    }
    var options: Foundation.JSONEncoder._Options
    let optionsLock: Synchronization.Mutex<()>

    var outputFormatting: Foundation.JSONEncoder.OutputFormatting {
        get
        set
    }
    var dateEncodingStrategy: Foundation.JSONEncoder.DateEncodingStrategy {
        get
        set
    }
    var dataEncodingStrategy: Foundation.JSONEncoder.DataEncodingStrategy {
        get
        set
    }
    var nonConformingFloatEncodingStrategy: Foundation.JSONEncoder.NonConformingFloatEncodingStrategy {
        get
        set
    }
    var keyEncodingStrategy: Foundation.JSONEncoder.KeyEncodingStrategy {
        get
        set
    }
    var userInfo: [Swift.CodingUserInfoKey : Any] {
        get
        set
    }
    init()
    func encode<A>(_: A) throws -> Foundation.Data where A: Swift.Encodable
    func encode<A>(_: A, configuration: A.EncodingConfiguration) throws -> Foundation.Data where A: Foundation.EncodableWithConfiguration
    func encode<A, B>(_: A, configuration: B.Type) throws -> Foundation.Data where A: Foundation.EncodableWithConfiguration, B: Foundation.EncodingConfigurationProviding, A.EncodingConfiguration == B.EncodingConfiguration

    deinit
}