What's New in Foundation: Parsing JSON in Swift 4 | Ray Wenderlich

In the past working with JSON meant using either NSJSONSerialization class or a third party library. Now it's a matter of implementing a simple protocol.

This is a companion discussion topic for the original entry at https://www.raywenderlich.com/4055-what-s-new-in-foundation-parsing-json-in-swift-4

Pretty cool, thanks!
What about nested objects? Is decoding just as easy?

So long as the nested objects support the codable protocol, you shouldn’t have any issues.

is it a personal preference (objc compatibility maybe) or is there any other reason for using reference type than value type for the objects i.e Article, Source… thanks

Hi Brian,

Short and great tutorial. The title is " Parsing JSON in Swift 4", does it also apply to Objective-C, or do we still need to parse JSON in Objective-C in old way? Thanks!

@mike You still have to use the NSJSONSerialization class for JSON parsing in Objective-C.

Objective-C? What’s Objective-C :wink: Yeah, it looks like Codable isn’t available for Objective-C.

Thanks, both! :grinning::grinning::grinning: