UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

SOLVED: Day 59: Milestone Project 13-15 (Load JSON challenge)

Forums > 100 Days of Swift

Hey everyone, I am having a challenge with loading the names of the country (from my created JSON file) to the table view. If you can kindly assist, here is the link to the GitHub repository where the project resides: https://github.com/leonardsangoroh/AfricanCountriesInfo Any help will be much appreciated.

Thank you in advance :)


Three steps to be made

  • Open your json file and remove this stuff at lines 433 - 435
  • You json has propery "countries" not "results" so you have to modify your Countries struct to
    struct Countries: Decodable {
    var countries: [Country]

and while decoding to this

countries = jsonCountries.countries
  • And finally in your Country struct update property
    var officialLanguage: String // this is string type not an array of strings!!!


@ygeras Thank you for your response.

I have made the first three changes and still the country names are not loading.

As for change 4, I am not sure if I should make is since some of the countries have more than one official language

Could there be an issue with the storyboard rather than the code?


Unless you do this var officialLanguage: String nothing will work. Yes, you have several languagues but this is still a string not array.

"Language 1, Language 2, etc" it is a string not an array.

I wrote all the steps after only making abovementioned changes. Otherwise it didn't work :)


Thank you very much :) It is now properly working

Thank you once again.


Hacking with Swift is sponsored by Essential Developer

SPONSORED Join a FREE crash course for mid/senior iOS devs who want to achieve an expert level of technical and practical skills – it’s the fast track to being a complete senior developer! Hurry up because it'll be available only until April 28th.

Click to save your free spot now

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

Unknown user

You are not logged in

Log in or create account

Link copied to your pasteboard.