I want to parse the json file below, but I keep getting the following error:
typeMismatch(Swift.Array, Swift.DecodingError.Context(codingPath: [], debugDescription: "Expected to decode Array but found a dictionary instead.", underlyingError: nil))
I have looked on stackoverflow, but they didn't seem to help as I don't see other json files that returns a dictionary value that is an array of strings. Any ideas?
//JSON file
{
pugs: [
"http://27.media.tumblr.com/tumblr_lqfwfyZuyS1qiyqyfo1_500.jpg",
"http://30.media.tumblr.com/tumblr_liic7bdmRF1qcipjro1_500.jpg",
"http://29.media.tumblr.com/tumblr_ll3xdp73DQ1qb08qmo1_500.jpg",
"http://29.media.tumblr.com/tumblr_lht5uy6khS1qed3e3o1_500.jpg",
"http://26.media.tumblr.com/tumblr_lrqnevtBvM1qb08qmo1_400.jpg",
"http://26.media.tumblr.com/tumblr_ll90kwmMJw1qzj3syo1_500.jpg",
"http://26.media.tumblr.com/tumblr_ll7aoxHGfW1qb08qmo1_500.jpg",
"http://24.media.tumblr.com/tumblr_lk27smb4sR1qzj3syo1_500.jpg",
"http://26.media.tumblr.com/tumblr_lil8a1m1YM1qzj3syo1_500.jpg",
"http://27.media.tumblr.com/tumblr_liy1xfY9G71qftdfxo1_500.jpg"
]
}
//Data Model
class PugList: Codable {
var pugs: [Pug]
var likes: Int
}
class Pug: Codable {
var images: [String]
}
]