# \#decodable

**URL:** https://forums.swift.org/tag/decodable/647.md

[Latest](https://forums.swift.org/latest.md) · [Categories](https://forums.swift.org/categories.md) · [Tags](https://forums.swift.org/tags.md)

---

## [Decoding with and without configuration handles \`container.currentIndex\` differently in case of errors](https://forums.swift.org/t/decoding-with-and-without-configuration-handles-container-currentindex-differently-in-case-of-errors/82329)

<div class="topic-metadata">

**Author:** [@m4p](https://forums.swift.org/u/m4p)\
**Replies:** 0\
**Last updated:** [September 24, 2025, 10:35am UTC](https://forums.swift.org/t/decoding-with-and-without-configuration-handles-container-currentindex-differently-in-case-of-errors/82329 "2025-09-24T10:35:09Z")

</div>

According to documentation, if an error occurs during try container.decode(T.self) container.currentIndex is not incremented. That seems to be the case. However, if I use try container.decode(T.self, configuration: c…

---

## [OrderedDictionary decoding](https://forums.swift.org/t/ordereddictionary-decoding/66829)

<div class="topic-metadata">

**Author:** [@Nostromo](https://forums.swift.org/u/Nostromo)\
**Replies:** 8\
**Last updated:** [December 20, 2024, 7:02am UTC](https://forums.swift.org/t/ordereddictionary-decoding/66829 "2024-12-20T07:02:30Z")

</div>

Hello, I created the bug here: OrderedDictionary decoding. · Issue #310 · apple/swift-collections · GitHub But now I'm curious, what is the correct approach to decoding here. Should it be fully compatible with an origi…

---

## [Decoding JSON fails on iOS 17: "Number \<...\> is not representable in Swift"](https://forums.swift.org/t/decoding-json-fails-on-ios-17-number-is-not-representable-in-swift/67546)

<div class="topic-metadata">

**Author:** [@tikitu](https://forums.swift.org/u/tikitu)\
**Replies:** 15\
**Last updated:** [December 4, 2024, 6:52pm UTC](https://forums.swift.org/t/decoding-json-fails-on-ios-17-number-is-not-representable-in-swift/67546 "2024-12-04T18:52:13Z")

</div>

Hi folks, I'm getting failures decoding json on iOS 17 that was successful on previous versions. The error is complaining that a number in the JSON is not representable in Swift, e.g. dataCorrupted( Swift.DecodingErr…

---

## [Unexpected decoding behavior of Int64](https://forums.swift.org/t/unexpected-decoding-behavior-of-int64/71762)

<div class="topic-metadata">

**Author:** [@kcatigbe-cbs](https://forums.swift.org/u/kcatigbe-cbs)\
**Replies:** 8\
**Last updated:** [May 11, 2024, 3:50pm UTC](https://forums.swift.org/t/unexpected-decoding-behavior-of-int64/71762 "2024-05-11T15:50:21Z")

</div>

When decoding an explicit signed 64 bit value (Int64), if that value is smaller than Int64.min, I am seeing the value being clamped to Int64.min. I am running this in Xcode 15.3 / M1Pro / Sonoma, but the same behavior h…

---

## [The synthesized implementation for \`Decodable\` doesn't interact with manual implementations as I would expect](https://forums.swift.org/t/the-synthesized-implementation-for-decodable-doesnt-interact-with-manual-implementations-as-i-would-expect/71028)

<div class="topic-metadata">

**Author:** [@jeremyabannister](https://forums.swift.org/u/jeremyabannister)\
**Replies:** 6\
**Last updated:** [April 2, 2024, 4:53pm UTC](https://forums.swift.org/t/the-synthesized-implementation-for-decodable-doesnt-interact-with-manual-implementations-as-i-would-expect/71028 "2024-04-02T16:53:28Z")

</div>

I was surprised to see that the codingPath contained inside of DecodingError is not populated with the full chain of coding keys when the error is thrown manually. For example, the following code: func test\_nestedDecod…

---

## [Can a type containing a Decodable protocol property, itself be Decodable?](https://forums.swift.org/t/can-a-type-containing-a-decodable-protocol-property-itself-be-decodable/64407)

<div class="topic-metadata">

**Author:** [@reflex](https://forums.swift.org/u/reflex)\
**Replies:** 4\
**Last updated:** [April 16, 2023, 1:19am UTC](https://forums.swift.org/t/can-a-type-containing-a-decodable-protocol-property-itself-be-decodable/64407 "2023-04-16T01:19:23Z")

</div>

I have a struct which contains a property. This property's type can vary, but will conform to a specified protocol. Problem is the struct itself won't conform to Decodable. Here's some basic code. protocol MyProtocol:…

---

## [How do I make a type that only successfully decodes from the empty object \`{}\`?](https://forums.swift.org/t/how-do-i-make-a-type-that-only-successfully-decodes-from-the-empty-object/64191)

<div class="topic-metadata">

**Author:** [@jeremyabannister](https://forums.swift.org/u/jeremyabannister)\
**Replies:** 5\
**Last updated:** [April 5, 2023, 1:03pm UTC](https://forums.swift.org/t/how-do-i-make-a-type-that-only-successfully-decodes-from-the-empty-object/64191 "2023-04-05T13:03:28Z")

</div>

I had assumed that this task would be simple before I started, but it has stumped me so far, and any help would be much appreciated. I have been using this type: struct EmptyCodable: Codable { } If I encode it with a J…

---

## [Property wrapper initialisation issues](https://forums.swift.org/t/property-wrapper-initialisation-issues/62407)

<div class="topic-metadata">

**Author:** [@jjrscott](https://forums.swift.org/u/jjrscott)\
**Replies:** 0\
**Last updated:** [January 5, 2023, 3:48pm UTC](https://forums.swift.org/t/property-wrapper-initialisation-issues/62407 "2023-01-05T15:48:42Z")

</div>

tl;dr How do I ensure my a property wrapper's init() is called when wrapped by another property wrapper, and how do I get to keep those values when decoding? struct Cow: Decodable { @Rules(deletion: .cascade) var fi…

---

## [Decodable - get reference to original position in JSON](https://forums.swift.org/t/decodable-get-reference-to-original-position-in-json/61050)

<div class="topic-metadata">

**Author:** [@gahms](https://forums.swift.org/u/gahms)\
**Replies:** 5\
**Last updated:** [October 28, 2022, 2:16am UTC](https://forums.swift.org/t/decodable-get-reference-to-original-position-in-json/61050 "2022-10-28T02:16:14Z")

</div>

I am using JSONDecoder to produce a nested set of objects from a JSON string. Is there a way, in the init(from decoder: Decoder) implementation on a nested class, to get a reference to where in the original JSON string i…

---

## [Circular init pattern not caught by compiler](https://forums.swift.org/t/circular-init-pattern-not-caught-by-compiler/55249)

<div class="topic-metadata">

**Author:** [@LemonCupcake](https://forums.swift.org/u/LemonCupcake)\
**Replies:** 10\
**Last updated:** [February 10, 2022, 8:54pm UTC](https://forums.swift.org/t/circular-init-pattern-not-caught-by-compiler/55249 "2022-02-10T20:54:15Z")

</div>

class Location: NSManagedObject, Decodable { var country: String = "" required convenience init(from decoder: Decoder) throws { try self.init(from: decoder) let container = try decoder.container(keyedBy: Cod…
