# Encoding and decoding references to other types with Codable

DevFeed: [Encoding and decoding references to other types with Codable](<https://devfeed.tech/articles/encoding-and-decoding-references-to-other-types-with-codable-39523.md>)

Original publisher: [Read original article](<https://rambo.codes/posts/2022-01-04-encoding-and-decoding-references-to-other-types-with-codable>)

Published: 2022-01-04T18:00:00Z

Content type: tutorial

Language: en

Sources: [Rambo Codes](<https://devfeed.tech/sources/rambo-codes.md>)

Topics: [Swift](<https://devfeed.tech/topics/swift.md>), [JSON](<https://devfeed.tech/topics/json.md>), [coding](<https://devfeed.tech/topics/coding.md>), [implementation](<https://devfeed.tech/topics/implementation.md>), [identifier](<https://devfeed.tech/topics/identifier.md>)

Tags: [coding](<https://devfeed.tech/tags/coding.md>), [identifier](<https://devfeed.tech/tags/identifier.md>), [implementation](<https://devfeed.tech/tags/implementation.md>), [json](<https://devfeed.tech/tags/json.md>), [swift](<https://devfeed.tech/tags/swift.md>), [version-control](<https://devfeed.tech/tags/version-control.md>)

## AI overview

This article discusses modeling references between user-configurable objects in a Swift app's document-based JSON model. It explains storing identifiers instead of duplicated nested data and considers customizing Codable encoding and decoding so the rest of the codebase remains unaware of the lookup implementation.

## Source excerpt

Gui Rambo writes about his coding and reverse engineering adventures.