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

keyDecodingStrategy breaks dictionary-keys

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Medium
    • Resolution: Done
    • Component/s: Foundation
    • Labels:
    • Environment:

      Xcode 9.3

      Swift 4.1

      macOS 10.13.4

      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:

      {
      "number_of_tables": 5,
      "amount_of_workers": {
      "android_developers": 4,
      "ios_developers": 3
      }
      }
      

       

      Will print:

      (numberOfTables: 5, amountOfWorkers: ["androidDevelopers": 4, "iosDevelopers": 3])

       

      instead of:

       

      (numberOfTables: 5, amountOfWorkers: ["android_developers": 4, "ios_developers": 3])

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                dungi Anh Dung
              • Votes:
                1 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: