Crash Course 101
10 modules
5 weeks


Click to copy

Introduction to the JSON format

In the previous modules, we introduced the concept of databases, discussed the types of data they store, and practiced sending REST API requests to retrieve data. At the same time, we remained an outside participant in the process and only requested information from various sources.

It's time to create your database! In this module, we will do just that, we will understand how data is stored in the database and how they can be interconnected. But first of all, let's start with the theory. Let's deal with the form in which the data comes to us, as well as with what categories the databases are divided into according to the data structure.


The absolute leader in data representation in the REST API is the JSON format. In all the examples from the previous modules, we received data in this format. It is worth recalling that REST does not impose restrictions on the choice of format for us, in the future you will surely meet others (for example, XML). At the same time, due to its light weight and easy human readability, developers often prefer JSON.

JSON (JavaScript Object Notation) is a text-based data exchange format based on JavaScript. And don't let the JavaScript in the title fool you. The JSON format, although it originated from this programming language, is completely independent of it and can be used anywhere.

Let's see what a JSON object consists of and how it is written.

All the data you received was enclosed in curly braces “{}”. They are always placed at the beginning and at the end of the JSON object.

The object itself consists of a set of records, which are “Key : Value” pairs and are separated from each other by commas “,”.

The key is the name of the entry itself, enclosed in quotation marks “”. Examples: “name”, “value”, “region”, “address”. It can be any word, the main thing when developing is to make sure that this meaning is clear.

JSON values types

Values ​​can be of various types. Let's consider them all.

String. Contains text information, a set of characters in the Unicode standard. Strings are enclosed in quotes “”.

Number. It can be either integer or floating point. It is written as is, it is not necessary to enclose quotes.

Boolean. One of two values. Either true or false. Like a number, it is written without quotes.

Array. An ordered set of elements. Each element can be of any type. An array is enclosed in square brackets “[]”, and its elements are separated by commas.

Object. The JSON value can be another JSON object. The same rules apply to it as to the root object. It is also enclosed in curly braces and contains its own set of records.

Look at the data you received in the first modules with this information in mind. Select the JSON components, determine what type the received values ​​belong to.

Was this article helpful?
Still looking for an answer?
Join the Community