CodingKeys non-decodable error

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. image.png 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"
    }
}

Recommended Posts

CodingKeys non-decodable error
tomcat error
Eclipse error
Deployment error
Error memorandum
FindBugs-IDEA error