这是我从服务器收到的JSON响应。我试图解析值没有任何成功。如何解析Swift 3中这个JSON响应的值?
{"items":
[{"item":
{ "id":824,
"company_id":31,
"config_id":45,
"imagesmall":null,
"imagethumb":null,
"pointofsales":null,
"status":true,
"endPlanned":false
}
},
{"item":
{ "id":889,
"company_id":74,
.
.
.
"status":true,
"endPlanned":false
}
}]
}
代码我想
if let json = try? JSONSerialization.jsonObject(with: data!, options: .allowFragments) as? [String: Any]{
print(json) // does work
let item = json?["items"] as? [[String: Any]]
print(item?[0]) // does work
// ... from here I am looking for the code to access the values and print it out ...
}
告诉我们你试过的东西。 –
不在这里[编辑您的问题](http://stackoverflow.com/posts/42000176/edit)与您的尝试代码和什么不工作。 –