You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SR-10630 JSONDecoder convertToSnakeCase no longer converts dictionary keys
Issue Description:
We tried to use the new keyDecodingStategy with convertFromSnakeCase to get rid of the big CodingKey-blocks in our App. But all Keys in our dictionary are made "SnakeCase" too, which leads to problems with some of our code and frameworks.
Yeah, this is the correct behavior. The encoding/decoding strategies apply to all values inside a payload — in this case, affecting Dictionary keys as well. If you need custom behavior (sometimes converting to snake_case, sometimes not), then you'll need to perform the conversion yourself.
Environment
Xcode 9.3
Swift 4.1
macOS 10.13.4
Additional Detail from JIRA
md5: ab934ce52f031c8bbf79753a55dfce79
relates to:
Issue Description:
We tried to use the new keyDecodingStategy with convertFromSnakeCase to get rid of the big CodingKey-blocks in our App. But all Keys in our dictionary are made "SnakeCase" too, which leads to problems with some of our code and frameworks.
So:
Will print:
(numberOfTables: 5, amountOfWorkers: ["androidDevelopers": 4, "iosDevelopers": 3])
instead of:
(numberOfTables: 5, amountOfWorkers: ["android_developers": 4, "ios_developers": 3])
The text was updated successfully, but these errors were encountered: