Daily iOS
Networking

Codable JSON decoding

The server responds with something like {"user_id": 3, "created_at": "2026-09-11T02:00:00Z"}. Can you walk me through how that response gets mapped onto a Swift model with Codable?

How would an interviewer hear this answer? You'll see whether they'd move on, dig in, or say no, and which sentences would trip you up. Your score doesn't change.
See the short answer

Codable is Encodable plus Decodable, synthesized by the compiler; JSONDecoder looks up values through CodingKeys and recursively calls each type's init(from:) to build the model.

Share a question