Uploaded image for project: 'Swift'
  1. Swift
  2. SR-10630

JSONDecoder convertToSnakeCase no longer converts dictionary keys

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Medium
    • Resolution: Unresolved
    • Component/s: Foundation
    • Labels:
    • Environment:

      Xcode 10.2.1 (10E1001)
      Apple Swift version 5.0.1 (swiftlang-1001.0.82.4 clang-1001.0.46.5)
      Target: x86_64-apple-darwin18.5.0

      Description

      JSONDecoder has regressed between Swift 4.2.4 and Swift 5.0.

      Encoding the value ["camelCase": 1] with .convertToSnakeCase would convert the key in Swift 4, but no longer does so in Swift 5.

      I can't find anything in the release notes suggesting that this is an expected outcome.

      A Swift file showing the issue is attached.

      ➤ ./swift-4.2.4-RELEASE.xctoolchain/usr/bin/swift ~/test.swift
      {"camel_case":1}
      
      ➤ ./swift-5.0-RELEASE.xctoolchain/usr/bin/swift ~/test.swift
      {"camelCase":1}
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                bendjones Ben D. Jones
                Reporter:
                stjernegard Danni Stjernegård
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated: