struct Item: Codable {
let itemName: String
let itemPrice: Int
private enum CodingKeys: String, CodingKey {
case itemName = "ItemName"
}
}
In this case, an error will occur because only itemName is defined in the case of CodingKeys. So adding one case will eliminate the error.
struct Item: Codable {
let itemName: String
let itemPrice: Int
private enum CodingKeys: String, CodingKey {
case itemName = "ItemName"
case itemPrice = "ItemPrice"
}
}