JSONDecodableParser

open class JSONDecodableParser<Model> : DataResponseSerializerProtocol where Model : JSONDecodable

JSONDecodable data response parser

  • Reading options to be used when reading JSON from Data, using JSONSerialization.

    Declaration

    Swift

    public let options: JSONSerialization.ReadingOptions
  • Defines how JSON should be preprocessed before passing to Model initializer.

    Declaration

    Swift

    public let traverseJSON: (JSON) -> JSON
  • Creates JSONDecodableParser with options.

    Declaration

    Swift

    public init(options: JSONSerialization.ReadingOptions, traversingJSON: @escaping (JSON) -> JSON = { $0 })
  • Method used by response handlers that takes a request, response, data and error and returns a result.

    Declaration

    Swift

    open func serialize(request: URLRequest?, response: HTTPURLResponse?, data: Data?, error: Error?) throws -> Model