I want to parse JSON using alamofire and swiftyjson
I try get JSON(value) like this
let headers: HTTPHeaders = [
"Authorization": "Basic Y2tfZTA1ZGNmMDkwNTNmODEyMGQwYTMyOGI4YzJkY2QzOTY5MmE5ZDAyNzpjc18zYzZiYWY2NTM0NDhkNDM4ZDM1ZDNmNDY5Nzg5ZGM2Y2VhZGRiZjNl",
"Accept": "application/json"
]
Alamofire.request("https://woo.demoapp.xyz/wp-json/wc/v2/products?category=15", headers: headers).responseJSON { response in
debugPrint(response)
if let json = response.result.value {
print("JSON: \(json)")
}
}
here is the JSON data from woocommerce api
[
{
"id": 29,
"name": "Sunglasses",
"permalink": "https://woo.demoapp.xyz/product/sunglasses/",
"description": "<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>\n",
"images": [
{
"id": 17,
"src": "https://woo.demoapp.xyz/wp-content/uploads/2017/10/sunglasses.jpg",
"name": "Sunglasses",
}
],
The issue is i am not able to populate an array with what I thought would be correct code to parse a JSON file with swiftyJSON in to tableview.
please use this type
//table view method
Upload Image With Parameter Using Alamofire