JSON:
{ "wishlist": [ { "wishlist": 0 } ], "cart": [ { "cart": 1 } ], "product": [ { "promo_id": 0, "avals": 0, "dis": null, "mp_product_id": 252, "mp_category_id": 113, "product_name": "Pink Soft Net Fabric Kids Angel Lehenga Choli", "product_description": " This Pink Coloured Traditional Soft Net Fabric Lehenga Choli gives a beautifull look to your child. This Outfit come with Brocket Fabric Lehenga and Top has Soft Net Fabric with Silk Lining come along with Soft Net Dupatta .\r\n\r\n You can make your kids wear this outfit for parties and functions.\r\n\r\n Type :\r\n\r\n *Semi-Stitched*\r\n\r\n FABRIC :\r\n\r\n Top : Unstitched Designer Brocade fabric \r\nBottom : stitched Soft Net fabric \r\nDupatta : Soft Net fabric \r\nInner : Silk fabric\r\n\r\n Size Chart :\r\n\r\n 1 to 5 year : 30 inches \r\n6 to 8 year : 32 inches \r\n9 to 10 year : 34 inches \r\n10 to 15 year: 36 inches\r\n\r\n Care \r\nDry Clean\r\n", "sku_number": "Angel_3_Pink", "qty": 25, "likes_count": 0, "list_price": 2082, "selling_price": 1249, "discount": 41 } ], "image": [ { "image_name": "Sweet Angel Vol3-Pink.jpg" } ], "variant": [ { "Color": "PINK", "Size": "S,M,L,XL", "Occasion": "Party" } ], "related": [ { "mp_product_id": 231, "mp_category_id": 113, "product_name": "White Peacock Kids Indo Western ", "product_description": " This White Coloured Traditional Banglory Top Fabrics Indo Western gives a beautifull look to your child. This Outfit come with Paper Silk Fabric Lehenga and Top has Banglory Fabric.\r\n\r\n You can make your kids wear this outfit for parties and functions.\r\n\r\n Type :\r\n\r\n *Stitched*\r\n\r\n FABRIC :\r\n\r\n Top - Banglory (foam seat work),\r\n\r\n Lehenga - Paper silk,\r\n\r\n Size Chart :\r\n\r\n 6 to 12 year : 34 inches\r\n\r\n Care \r\nDry Clean\r\n", "product_image": "", "seller_product_code": "White_Peacock", "system_product_code": 0, "sku_number": "White_Peacock", "status": "A", "is_features": 0, "list_price": 2271, "selling_price": 1249, "qty": 25, "weight": "700", "cod_charge": "0", "shipping_charge": "0", "likes_count": 0, "create_date": "2017-06-26 12:38:51", "modify_date": "2017-06-26 12:39:37", "main_order": 14, "set_order": 0, "image_name": "Peacock White Kids \u00a0--- CKL 216 --- Rs. 625.jpg" }
答案 0 :(得分:0)
是的,你正在做同样的事情,但你的代码很容易崩溃,因为你有力地试图打开选项。试试这个
Alamofire.request(APIProductDetail, method: .get, parameters: params, encoding: URLEncoding.default, headers: nil).responseJSON { (response) in
switch response.result {
case .success(let responseResultValue):
if let responseResult = responseResultValue as? [String:Any] {
if let productsList = responseResult["product"] as? [[String:Any]] {
for product in productsList {
if let productDescription = product["product_description"] as? String {
print(productDescription) //Here you will get the product description
}
}
}
}
case .failure(let error):
//handle any error here
print(error.localizedDescription)
}
}