struct ProductDetails:Codable {
var custom_attributes:[CustomAttributesData]
struct CustomAttributesData:Codable {
var attribute_code:String
var value:String
}
}
I have an Array of custom_attributes has dictionary with elements of attribute_code as String & value as String, but some value datatype's are in Array, due to Array I am not able to parse using codable, help me out, Thanks in advance
"custom_attributes": [
{
"attribute_code": "image",
"value": "/6/_/6.jpg"
},
{
"attribute_code": "small_image",
"value": "/6/_/6.jpg"
}
{
"attribute_code": "news_to_date",
"value": "2017-09-30 00:00:00"
},
{
"attribute_code": "category_ids",
"value": [
"2",
"120"
]
},
{
"attribute_code": "options_container",
"value": "container2"
}
]
I have added json above.
init(from decoder: Decoder). Add ado - catchblock and decodeString. If it throws an error decode[String]