How can I decode a JSON to a Swift struct ignoring all the fields that are not in both the json and the struct?
I’m getting an exception when decoding this json to the Device struct below. JSON { "SerialNumber": "123", "Model": "iPhone14" "Brand": "Apple" } Swift struct: struct Device : Codable, Identifiable { var id = UUID().uuidString let SerialNumber : String let Model : String let Brand : String } To get around this, I have to add… Read More How can I decode a JSON to a Swift struct ignoring all the fields that are not in both the json and the struct?