Swift 4 Codable

I recently started working with the Swift 4 Codable system. This new feature in Swift 4 is amazing when working with JSON data. Although as it is new I found it very difficult to get details about how to work with certain types of data. How do you work with JSON arrays that you want to turn into an array of Swift objects? How do you deal with a JSON object with a JSON object? How do you manage optional items in a JSON object that might exist or might not?

There are a ton of edge cases that are unique to each type of data and every application. So far since Swift 4 is so new I haven't been able to find too many resources for dealing with all of these edge cases and unique sets of data. So when working with the Codable I posted a lot of questions on Stack Overflow. I have linked all of them at the bottom of this post in case you are interested in looking at them.

One of the best things about the Swift 4 Codable system is how truly flexible it is. So far I have been able to solve every problem for every JSON object. Considering how unique each JSON object is that is truly impressive.

In order to deal with each edge case I would highly encourage everyone to look through those Stack Overflow questions. I was unable to find any information on each specific case. I'm sure it's somewhere in Apple's API documentation but sometimes seeing a question or example code is much more helpful.

And if you haven't tried the Swift 4 Codable system I highly recommend it. It's a great way to serialize and deserialize JSON data in your Swift applications.

https://stackoverflow.com/questions/45928894/swift-4-codable-arrays
https://stackoverflow.com/questions/46723619/using-decodable-protocol-with-multiples-keys
https://stackoverflow.com/questions/46728324/swift-codable-decode-manually-optional-variable
https://stackoverflow.com/questions/46740160/swift-decodable-optional-key