Decode JSON in Swift: A Full Micro-Project

A whole project?

Steven Curtis
4 min readFeb 17, 2021


Photo by Michael Dziedzic on Unsplash

Before we start

Difficulty: Beginner | Easy | Normal | Challenging

The video

The content of this article is covered in the following video!


  • This article skips over setting up a project, and gets rid of the storyboard and uses programmatic constraints as in this article
  • Later in the article a real example is used, that is Decoding JSON and the internal workings of this are kind of skipped over
  • If you are interested in testing, or a more in-depth explanation of JSON decoding you can look at this article

Keywords and Terminology:

JSON: JavaScript Object Notation, a lightweight format for storing and transporting data Swift: An open source programming language for macOS, iOS, watchOS and tvOS

The project implementation

The expected result

This Project is going to take data from an endpoint (the specific endpoint is one of those hosted at reqres) and displays the result in a UITextView.

The end project looks something like the following:

So let us press on!

I’ve used [weak self] (the difference between weak and unowned is explained here )

The detail

Users Model The model is defined by the structure of the data from the endpoint. is