Hello friends I need your help for reading the array from the json object.
like
{"info":[{"memoID":"3","memoName":"Hello"}]}
using SwiftyJSON
when I'm in android I can use
JSONArray array = object.getJSONArray(“info”);
JSONDecoder
let content = try? JSONDecoder().decode(Root.self , from: data)
print(content)
// MARK: - Empty
struct Root: Codable {
let info: [Info]
}
// MARK: - Info
struct Info: Codable {
let memoID, memoName: String
}
SwiftyJson
if let res = arr["info"].array { // arr is of type JSON
print(res)
}
Alamofire or what see edit
Codableprotocol is built-in (no dependencies!) and more efficient.