JSONParser
public class JSONParser
JSONParser parses the data of a JSON structure.
Version
1.5.0Date
26/03/2019-
Initialize the parser.
Declaration
Swift
public init?(data: Data)
Parameters
data
The JSON data.
-
Initialize the parser.
Declaration
Swift
public convenience init?(string: String)
Parameters
string
The string data.
-
Get an array element.
Declaration
Swift
public func array(atPath path: String, fromNode node: Any? = nil) -> [Any]?
Parameters
path
The json path. Absolute path is equals to where the node is nil.
node
Current node.
Return Value
The array element. Nil if it cannot be found.
-
Get a string element.
Declaration
Swift
public func string(atPath path: String, fromNode node: Any? = nil) -> String?
Parameters
path
The json path. Absolute path is equals to where the node is nil.
element
Current element.
Return Value
The string element. Nil if it cannot be found.
-
Get a double element.
Declaration
Swift
public func double(atPath path: String, fromNode node: Any? = nil) -> Double?
Return Value
The double element. Nil if it cannot be found.
-
Get a dictionary element.
Declaration
Swift
public func dictionary(atPath path: String, fromNode node: Any? = nil) -> [String: Any]?
Parameters
path
The json path. Absolute path is equals to where the node is nil.
element
Current element.
Return Value
The dictionary element. Nil if it cannot be found.