Working with JSON in Xcode Downloading and Listing JSON Data in TableView in iOS

  • Tihomir Radev

Your browser needs to be JavaScript capable to view this video

Try reloading this page, or reviewing your browser settings

You're watching a preview of subscription content. Log in to check access

Download JSON data from an online location into your iOS apps. You’ll work a sample list of contacts with email addresses, phone numbers, names, and other relevant information. You’ll then see how to format the data properly and list it in a TableView to be more user-friendly to read for display in your app.

Working with JSON in iOS is one of the most useful pieces of knowledge for a developer. It’s used on a daily basis in a wide variety of apps. Displaying online data in an app is an essential part of the iOS ecosystem. Learn how to download text from a server and then format the data properly with Codable in Swift. Using custom cells, you’ll build a TableView then place everything in an adaptable AutoLayout. Finally, you’ll populate the TableView with the formatted JSON data represented by an array of custom items. By the end of this video, you’ll be able to incorporate JSON data into your apps in a user-friendly and easily accessible manner.

What You Will Learn

  • Format JSON data properly with Codable in Swift

  • Build a TableView with custom cells

  • Place data in adaptable AutoLayout

Who This Video Is For

iOS developers with advanced skills in Xcode and Swift who want to incorporate JSON data displayed properly in their apps.

Get working with JSON in Xcode in this video that shows you how to download JSON data from an online location into your iOS apps.

About The Author

Tihomir Radev

Tihomir Radev is a freelance mobile app developer operating in Bulgaria. He has years of experience as an independent developer and has contributed to corporate and industry projects. He also has indie projects of his own available on the Google Play and App stores. Tihomir creates Android Studio and Xcode tutorials on YouTube in addition to his development work to give back to the development community.


Supporting material

View source code at GitHub.

About this video

Tihomir Radev
Online ISBN
Total duration
34 min
Copyright information
© Tihomir Radev 2020

Related content

Video Transcript


Hello, I’m going to show you how to create simple contacts app for iOS. That will list a few contacts with names, phones, and other information for random people. At the start of the project, I will show you how to create the basic iOS project and setting up the files needed to format the downloaded JSON data properly. Here we will use decodable framework from Apress standard libraries.

Then we will download the JSON data from the server. To test that with properly formatted JSON files, we will bring the downloaded result in the debug area of the project as a text. Later in the app, we will remove this part, and we will display all the data in the TableView.

After successfully downloading the data, we will use AutoLayout in the storyboards to add our TableView to the screen. Then we will add the TableView cell in the TableView itself so it can design it for our contacts. I will show you how to connect the design of the cell in the table with their Swift files.

Here will create default TableView methods and prepare our TableView cell for the adjacent data. We should properly connect all JSON elements with their elements in the TableView cell. Here we can finally remove the all debug printing of the JSON data and display it in the proper format in our TableView. Finally, I will show you how to add additional entries in your JSON file and display them in the app itself.