# JSON Encoding / Decoding weird encoding of dictionary with enum values

**URL:** <https://forums.swift.org/t/json-encoding-decoding-weird-encoding-of-dictionary-with-enum-values/12995>\
**Category:** Using Swift\
**Tags:** codable, json\
**Created:** [May 26, 2018, 10:54pm UTC](https://forums.swift.org/t/json-encoding-decoding-weird-encoding-of-dictionary-with-enum-values/12995 "2018-05-26T22:54:33Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![itaiferber](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/itaiferber/32/33840_2.png) [@itaiferber](https://forums.swift.org/u/itaiferber)\
**Post date:** [May 27, 2018, 1:59am UTC](https://forums.swift.org/t/json-encoding-decoding-weird-encoding-of-dictionary-with-enum-values/12995/7 "2018-05-27T01:59:29Z")

</div>

I agree that this is more a bug than a feature; this was an oversight in the implementation as far as I’m concerned. Something that is `RawRepresentable` as a `String` or `Int` encodes as a `String` or `Int` by default everywhere else, and I don’t think this should be different.

The one thing we need to figure out is how bad the regression would be if we changed behavior, as we would introduce incompatibility in the other direction.

Do you or @zarghol mind filing a bug about this, please? If we don’t break too much, we should do this sooner rather than later before folks rely on this behavior (if that’s really possible).

---

_[View the full topic](https://forums.swift.org/t/json-encoding-decoding-weird-encoding-of-dictionary-with-enum-values/12995)._
