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
Fix JSONEncoder key conversion for CodingKeyRepresentable dictionary keys
When encoding dictionaries with CodingKeyRepresentable keys (e.g., custom
enum or struct keys), JSONEncoder was incorrectly applying key encoding
strategies like convertToSnakeCase to the dictionary keys themselves,
rather than treating them as semantic keys that should remain unchanged.
This change:
- Expands _JSONStringDictionaryEncodableMarker protocol coverage from
String-keyed dictionaries to any CodingKeyRepresentable-keyed dictionaries
- Renames the protocol to _JSONCodingKeyRepresentableDictionaryEncodableMarker
to better reflect its expanded scope
- Updates the encoding logic to handle CodingKeyRepresentable keys by
converting them directly to their string representation
Fixes encoding behavior where Dictionary<CustomKey, Value> keys were
being transformed (e.g., "leaveMeAlone" -> "leave_me_alone") when they
should preserve their original form.
0 commit comments