ATJSON

Undocumented

  • Creates a JSON using the data.

    Declaration

    Swift

    public init(data:Data, options opt: JSONSerialization.ReadingOptions = .allowFragments, error: NSErrorPointer? = nil)

    Parameters

    data

    The NSData used to convert to json.Top level object in data is an NSArray or NSDictionary

    opt

    The JSON serialization reading options. .AllowFragments by default.

    error

    error The NSErrorPointer used to return the error. nil by default.

    Return Value

    The created JSON

  • Create a JSON from JSON string - parameter string: Normal json string like ‘{a:b}’

    Declaration

    Swift

    public static func parse(_ string:String) -> ATJSON

    Parameters

    string

    Normal json string like ‘{“a”:“b”}’

    Return Value

    The created JSON

  • Creates a JSON using the object.

    Declaration

    Swift

    public init(_ object: Any)

    Parameters

    object

    The object must have the following properties: All objects are NSString/String, NSNumber/Int/Float/Double/Bool, NSArray/Array, NSDictionary/Dictionary, or NSNull; All dictionary keys are NSStrings/String; NSNumbers are not NaN or infinity.

    Return Value

    The created JSON

  • Creates a JSON from a [JSON]

    Declaration

    Swift

    public init(_ jsonArray:[ATJSON])

    Parameters

    jsonArray

    A Swift array of JSON objects

    Return Value

    The created JSON

  • Creates a JSON from a [String: JSON]

    Declaration

    Swift

    public init(_ jsonDictionary:[String: ATJSON])

    Parameters

    jsonDictionary

    A Swift dictionary of JSON objects

    Return Value

    The created JSON

  • Object in JSON

    Declaration

    Swift

    public var object: Any
  • json type

    Declaration

    Swift

    public var type: Type
  • Error in JSON

    Declaration

    Swift

    public var error: NSError?
  • Undocumented

  • The static null json

    Declaration

    Swift

    public var startIndex: Index
  • The static null json

    Declaration

    Swift

    public var endIndex: Index
  • The static null json

    Declaration

    Swift

    public func index(after i: Index) -> Index

    Parameters

    i

    A valid index of the collection. i must be less than endIndex.

    Return Value

    The index value immediately after i.

  • Find a json in the complex data structuresby using the Int/String’s array.

    let json = JSON[data] let path = [9,list,person,name] let name = json[path]

    The same as: let name = json[9][list][person][name]

    Declaration

    Swift

    public subscript(path: [JSONSubscriptType]) -> ATJSON

    Parameters

    path

    The target json’s path. Example:

    Return Value

    Return a json found by the path or a null json with error

  • Find a json in the complex data structures by using the Int/String’s array.

    let name = json[9,list,person,name]

    The same as: let name = json[9][list][person][name]

    Declaration

    Swift

    public subscript(path: JSONSubscriptType...) -> ATJSON

    Parameters

    path

    The target json’s path. Example:

    Return Value

    Return a json found by the path or a null json with error

  • Declaration

    Swift

    public init(stringLiteral value: StringLiteralType)

    Parameters

    value

    The value of the new instance.

  • Declaration

    Swift

    public init(extendedGraphemeClusterLiteral value: StringLiteralType)

    Parameters

    value

    The value of the new instance.

  • Declaration

    Swift

    public init(unicodeScalarLiteral value: StringLiteralType)

    Parameters

    value

    The value of the new instance.

  • Declaration

    Swift

    public init(integerLiteral value: IntegerLiteralType)

    Parameters

    value

    The value to create.

  • Declaration

    Swift

    public init(booleanLiteral value: BooleanLiteralType)

    Parameters

    value

    The value of the new instance.

  • Declaration

    Swift

    public init(floatLiteral value: FloatLiteralType)

    Parameters

    value

    The value to create.

  • URL

    Undocumented