3 回答
TA贡献1844条经验 获得超8个赞
像上面提到的那样,您可以使用SwiftyJSON库并像我在下面所做的那样获取您的值
Alamofire.request(.POST, "MY URL", parameters:parameters, encoding: .JSON) .responseJSON
{
(request, response, data, error) in
var json = JSON(data: data!)
println(json)
println(json["productList"][1])
}
我的json产品列表从脚本返回
{ "productList" :[
{"productName" : "PIZZA","id" : "1","productRate" : "120.00","productDescription" : "PIZZA AT 120Rs","productImage" : "uploads\/pizza.jpeg"},
{"productName" : "BURGER","id" : "2","productRate" : "100.00","productDescription" : "BURGER AT Rs 100","productImage" : "uploads/Burgers.jpg"}
]
}
输出:
{
"productName" : "BURGER",
"id" : "2",
"productRate" : "100.00",
"productDescription" : "BURGER AT Rs 100",
"productImage" : "uploads/Burgers.jpg"
}
- 3 回答
- 0 关注
- 1387 浏览
添加回答
举报