Decoding JSON with a reserved property name

I need to decode JSON into a class. The JSON has a field called "Type", and I cannot declare a property with that name in my class since Type is a reserved word.

I tried declaring CodingKeys, but that doesn't work unless I declare EVERY property in the CodingKeys. This class has about a hundred properties and I have others like it, I do not want to do this.

Is there a better solution?

Have you tried using backticks?

var `Type`: String

Coding keys are recommended. You can use some form of API code generation with an endpoint or API spec to generate the code for you if 100+ keys are too much to type.

Decoding JSON with a reserved property name
 
 
Q