I have the following struct that I send to an endpoint:
struct IdleAlarmRequest: Encodable {
let idleAlarm: [IdleAlarmParameters]
enum CodingKeys: String, CodingKey {
case idleAlarm = "IdleAlarm"
}
}
No matter what I do idleAlarm
will always be written as idle_alarm in the resulting JSON string. This should be IdleAlarm
as "objects" are PascalCased with this API, only fields should be snake_cased. Decodable
works fine.
All of the other fields in all of the objects are snake_cased so if I don't use snake_case I need to add CodingKeys for hundreds of fields.