If you don’t know JSON I can tell you that it’s a syntax for storing and exchanging data. It’s widely used in web services, so most mobile software engineers need to know how to work with it. JSON file is a text file and it is converted into objects in object oriented programming languages like Swift. These objects then represent the JSON data. The abbreviation comes from JavaScript Object Notation.

Often software engineers need to read the JSON and convert it into objects. It’s less common that an engineer have to design a JSON file, but sometimes there’s a need to do just that. I follow two simple guidelines when I create a JSON file:

1. I keep the JSON file as minimalistic as possible, so there’s nothing unnecessary
2. I use a hierarchy that fits well to the use case

These two simple rules make the code to convert JSON into objects elegant and easy to maintain. That on the other hand leads to less bugs.

Leave a Comment

Your email address will not be published.