The FMPUtils.QueryResultParser class is used to handle JSON responses as a result of queries to database. It inherits from the FMPUtils.Parser class.
class QueryResultParser : FMPUtils.Parser
Method | Description |
getRecords() | Get a list of records from JSON structure. func getRecords() -> [NSDictionary]? |
Get list of records:
let json: NSDictionary = ["status" : "ok", "result" : ["database" : ["records" : [["key1" : "value1"], ["key2" : "value2"]]]]]
// Build an instance of the FMPUtils.QueryResultParser class. For details see examples for FMPUtils.QueryResultParser.Builder.
let queryResultParser: FMPUtils.QueryResultParser = FMPUtils().queryResult
.json(json)
.build()
// Get list of records
let records: [NSDictionary]? = queryResultParser.getRecords() // [["key1" : "value1"], ["key2" : "value2"]]
See also: