‫Hello, my friends, and welcome back.
‫In this video, we'll learn about the Json syntax.
‫So Json stands for JavaScript object notation.
‫It's an independent data exchange format.
‫You can see in this picture that when we send a request from our app to the server, the server response
‫is in Json format.
‫So our mission is to parse this type of files and types and data formats and transform it from Json
‫objects into Kotlin objects and display them into our application.
‫So this is our mission.
‫This is our goal when dealing with retrofit and when displaying data from the server.
‫What are the Jason elements?
‫A Json file consists of many components.
‫An array in a Json file square bracket represents a Json array.
‫Objects in a Json file.
‫Curly brackets represents a Json object.
‫Key adjacent object contains a key that is just a string.
‫Pairs of key value make up as Json object value.
‫Each value each key has a value that could be string, integer or double and etcetera.
‫We will dive into these four elements in the next couple of minutes, but I want from you to get a paper
‫and your notebook.
‫Write these elements into your copy book and try to figure out because we are going to deal with the
‫Json files.
‫And I want from you to understand the hierarchy of the Json file in order to understand it well and
‫create the corresponding objects, data classes, the pojo classes and understand how Json works.
‫By the way, it's very simple.
‫You may consider it as a complex thing, but don't worry.
‫I guarantee for you that you will master Json and parsing Json files and using retrofit at the end of
‫this section.
‫So please follow me.
‫Let's start with the Jason Keys in.
‫Jason, This is the file.
‫This is a Json file.
‫This is in this format.
‫You will see the data in Jason Keys.
‫Must be strings written with double quoted or double quotes.
‫The name here represent a key disc in blue will represent a key value is a key.
‫Potion name represent a key effect represent a key.
‫So in Json keys must be strings written with double quotes.
‫This is the keys.
‫Jason Values.
‫In Json values must be one of the following types a string, a number, an object, an array, a boolean
‫or null.
‫In Json string values must be written with double quotes.
‫If we go back to here, we can see that the keys are strings, so please pay attention.
‫The keys should be strings, but the values can be string number, object array, boolean or null.
‫Here we have these two dots.
‫The key and the value separated by comma.
‫Another key value pair.
‫So you can see how the structure of the Json is is created.
‫Let's move to the Json object.
‫Json objects literals are surrounded by curly braces.
‫Json objects.
‫Literals contains key value pairs.
‫Keys and values are separated by colons.
‫So you can see this is the beginning of the Json object, the curly braces and the end of the Or the
‫closing curly braces is representing the end of the object.
‫Keys must be strings and values must be valid.
‫Json data format string name number object array boolean null.
‫Each key value pair is separated by comma, so you can see that this object, this is the first object
‫here.
‫And you can see the comma between the two curly braces here.
‫This is the opening and this is the end is separated by the comma.
‫And this is a new Json object.
‫This is object number two.
‫Jason Array.
‫Arrays in Json are almost the same as arrays in JavaScript.
‫In Json array values must be of type string number, object array, boolean or null.
‫In Json file, square brackets represent a Json array, so you can see this is an array, a Json array
‫that contains.
‫Do, Jason objects.
‫This is the first one and this is the second one.
‫So two objects, two Json objects are, are created inside this array which is named as key as effect.
‫So the key is effect.
‫The value is an array.
‫So you can see, guys, this is a very quick representation of, of the Json syntax.
‫This is the key and a value is an array.
‫So this is an array.
‫The value here, this array contains two objects.
‫This is the first object and this is the second object.
‫And by the way, this is all about the Json syntax.
‫It's very easy.
‫I want from you to practice.
‫Well, take your time to understand the concept, the hierarchy of Json and don't worry, we will practice
‫them well in order to master it.