JSON

public class JSON: AnyObject, CustomDebugStringConvertible

This abstraction helps working with the JSON Format.

It provives a way to access JSON values via subscripting, whether it’s an array or a dictionary.

  • This is the raw data of the JSON

    Declaration

    Swift

    public var data: AnyObject?
  • This date formating strategy that will be used for that JSON section. This should not be set, use dateFormat instead.

    Declaration

    Swift

    public var jsonDateFormat: String?
  • This build a JSON object with raw data.

    Declaration

    Swift

    public init?(_ dic: AnyObject?)
  • Returns

    The array of JSON values. In case of the JSON being a dictionary, this will return nil.

    Declaration

    Swift

    public var collection: [JSON]?

    Return Value

    The array of JSON values. In case of the JSON being a dictionary, this will return nil.

  • This defines the date format to be used for NSDate parsing.

    createdAt <-- json["created_at"]?.dateFormat("yyyy-MM-dd'T'HH:mm:ssZZZZZ")
    

    Returns

    Itself for chaining purposes.

    Declaration

    Swift

    public func dateFormat(format: String) -> Self

    Return Value

    Itself for chaining purposes.

  • This is just for supporting default console logs.

    Declaration

    Swift

    public var debugDescription: String