RawRepresentable

protocol RawRepresentable
  • Converts an instance of a conforming type to JSON. - returns: An instance of JSON where the enum case is whatever the underlying RawValue converts to.

    Declaration

    Swift

    public func toJSON() -> JSON

    Return Value

    An instance of JSON where the enum case is whatever the underlying RawValue converts to.

  • An initializer to create an instance of RawRepresentable from a JSON value. - parameter json: An instance of JSON. - throws: The initializer will throw an instance of JSON.Error if an instance of RawRepresentable cannot be created from the JSON value that was passed to this initializer.

    Declaration

    Swift

    public init(json: JSON) throws

    Parameters

    json

    An instance of JSON.