当从webservice解码JSON响应时,我得到一个输出说法:
["dataresult": <__NSArrayM 0x1c0243090>( )]
如何显示/解码此NSArrayM
对此有任何帮助将不胜感激
以下是代码
let json = try JSONSerialization.jsonObject(with: data!, options: .mutableContainers) as? NSDictionary
print("JSON yet to be parsed")
if let parseJSON = json {
let myBoard = parseJSON["message"] as! [String:Any]
print("JSON parsed successfully !")
print(myBoard)
if let refResults = myBoard["dataresult"] as? [[String:String]]{
let valueArray = refResults.map {$0["Success"]!}
self.Contact = valueArray
print(self.Contact)
}
来自网络服务的回复:
"message": {
"dataresult": [
{
"Success": "Success",
"OwnerName": "test shop",
"mobileno": "1231231231",
"landline": "",
"managername": "acsd acfacaf",
"managerContact": "",
"email": "test@gmail.com",
"website": "",
"address": "gggysgyysusisss",
"city": "hgyggg",
"area": "fgatsbsuhsushsu",
"pincode": "123123",
"rentowned": "Leased",
"homedelivary": "Yes",
"working_start_time": "10.00 am",
"working_end_time": "7.30 pm",
"pwd": "123123"