How to manually decode [Album] and [Image] by keys ? I tried, but I can not. I do not know what the error is? Thank you ! My Json http://appscorporation.ga/api-user/test
struct ProfileElement: Codable {
let user: User
let postImage: String
let postLikes: Int
let postTags: String
enum CodingKeys: String, CodingKey {
case user
case postImage = "post_image"
case postLikes = "post_likes"
case postTags = "post_tags"
}
}
struct User: Codable {
let name, surname: String
let profilePic: String
let albums: [Album]
enum CodingKeys: String, CodingKey {
case name, surname
case profilePic = "profile_pic"
case albums
}
}
second blok
struct Album {
let id: Int
let title: String
var images: [Image]
enum AlbumKeys: String, CodingKey {
case id = "id"
case title = "title"
case images = "images"
}
}
struct Image: Codable {
let id: Int
let url: String
enum CCodingKeys: String, CodingKey {
case id = "id"
case url = "url"
}
}