Learn JSON in 20 Minutes (For FREE) | Coding United | Skillshare

Learn JSON in 20 Minutes (For FREE)

Coding United

Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
5 Lessons (19m) View My Notes
    • 1. Welcome to the World of JSON

    • 2. The Syntax of JSON

    • 3. Primitive Data Types

    • 4. Advanced Data Types

    • 5. Course API Project


About This Class

Hello everyone and in this course I will be teaching you everything there is to know about the popular data language called JSON.  Almost all data used in programs today is JSON.  Almost every single API in the world returns JSON data.  It is a uniform solution to the massive amount of data in this world today.  I tried to keep this course short as JSON is a very simple data language to learn with very little differences!  Now, join me in this course to learn how to understand how to write and read JSON!


1. Welcome to the World of JSON: Hello, everyone. And then this course I will be teaching of Ah, the basics of James son, which is a data language that used to store data. So if you ever learned about an A P I, which is basically you just go to a euro, and then it gives you back data, and most of the time that data is in the form of Jason. So here's one example AP I request looks like and so you can see this is what the Jason file and this is all of the data that it has, and you can store as much data or is little data as you want instead of your son. And so, as you can see here, they have all of these different names and then values to them. And there's many different types that are in here, and we will be learning about all of these different types who, then, when you look at this, you'll understand exactly what this is and all these different commas and double quotations and everything. So if you would like to understand how this works and welcome yourself into the world of data science, then I would just continue washing this course 2. The Syntax of JSON: Hello, everyone. And in this lecture will be teaching you the syntax of Jason. So the first thing that you have to have in every JSA viol is an opening and closing curly brace inside of here. You can have all of your data, but you can just leave it like this in the Jason. Final is perfectly correct. It's just that you don't have any data inside of it. Usually you just would press enter to open up this curly brace, and then you can have your data inside of here. Do you have a name? Such value hair. And that's how you define variables inside of Jason. So we're just gonna have in the name at home. Always must be enclosed with end quotations. So I'm gonna have this. And this is the name of the variable. So I can put my name and then to have the value of it, I have to do a colon and in space. And then I want this to be a type of string, which is basically just text and you'll learn that in the next lecture. So I'm just gonna open up quotes from say, Carter. So then my name is assigned to the value of Carter. But since this is enclosed within double quotes the variable name, you aren't able to type double quotes inside of there these things that this is a variable name and this is just some air. So to escape out of that, if you actually do want have close inside of there, you can just do a backslash and that will make it. Son, You can have these clothes inside of here but actually advised against using any backslash because it's not very good programming techniques, tohave approach within Jason names and using the back selections when you could just not even haven't. So in the next couple of lectures you'll be learning about the data types instead of Jason , which is basically what you're signing these names, too. 3. Primitive Data Types: Hello, everyone. And in this lecture I'll be teaching about the primitive types of J. SARD. So this one of the simplest types is strength. So it's basically just regular tax, and it is always contained within double quotes. It can contain all characters, including numbers and spaces. In some of the values that can have is the boring cars that Amazing Houses fund. We can also have off fun, different symbols in numbers. So the nice type is numbers, and it can only be digits one through nine negative numbers and decimals. We're also able to contain experience, but we won't talk about that in this course piece. It's kind of complicated with this in textual writing it, but you do not have double close for the numbers. You just put in the value of, like one hard 29 negative 42 or 43.5. The third type that we have been running in this lecture is brilliance, and this can only be true or false. It's very simple to understand, and one thing that's important to note is that the T and F are lower case when you're typing it in. In Jason, unlike some programming languages like, um, Python. So the fourth kind of debated data type that I will be talking about is no. Which basically means there isn't a value. So you could be a sounding it later, or you could just say there's nothing there right now. I just want to state the name. So now we're gonna start typing these out in the actual J son file. So first of all, we're gonna do a string. And so I'm just gonna put in when I open up the quotes for the name of this, So I'm gonna say my name. Then we're gonna have a colon to Sunday value, and then we're gonna open up the double guns because that's what you do for shrinks. And then we're gonna say, Carter, someone was defined my name to have the value of Carter the no. Sure, doing a number. And so we'll say my age and actually where surface of this double close and then we're just gonna pretty number of 15. And then this My age is under the value. 15 you know, was trying doing a Bruin. So I'm gonna say is 18. Oh, it is over 18 and we're gonna set the phone because I'm not. So this could also be true. But since I'm not over 18 it's going to be false. So, actually, instead of just doing 15 for my age, I could do, like, 15.345 whatever it is for decimals. And then finally, we're gonna use No. So I'm gonna have, uh, my wife, and we're gonna put that to know because I actually don't have a wife, but we can define it right now. So maybe if I do, we could assigned the value of my wife to their name. So in the next lecture, we're gonna be learning about what are the more advanced types inside of Jason? 4. Advanced Data Types: who are everyone in this lecture? We're gonna learn being learning about the advanced types instead of Jason and former. Start this. I just wanna explain what a names lunch value pair is. It's basically just have the name of the variable, and then it's value and the value could be any time in the name could be anything. And so, for the first data type we're gonna be learning about it is the object, and it can contain a scent of a new ordered name. Slash value. Paris. So this located between the curly braces that are separated by comments and it can contain zero or more name slash value pairs so it could be empty as, And this this is just an object. It's an empty object. The second data type isn't array, and this contains a set of ordered values between the brackets and these are the brackets and the values. Air also separated by comments, but note that the values inside of an array it's they don't have a name, so you can just access them inside of here and right dog can't and you don't know which would. The name of each of these are peas. They don't have one. You access it using their indices, which is base agree. In some program languages. This would be zero, and this would be one, and then you could access it using the name of the array. So I'm just gonna call this one array. Then you do zero, and they would give you dog. That's just a little example of what it would be like in Java script. So now he's going to the J. Some file that we made in the life's lecture, and I'm gonna transform this. Then we can use the objects in the race, and we're also gonna add some more David. So instead of having all these separate, different value variables, I'm just gonna create one me number. Name it me. It's gonna have a value of an object. So we're gonna open this up, and then we're gonna put name and then we're gonna set this. Carter, we're gonna age. We're gonna have a 15.345 and then we can have is over 18 and who considered to false and then my wife and there is no so I can do it. All of this and I can also have another. I'm gonna use the array. No, and I'm gonna have coke Favorite favorite colors. So these were all my favorite colors. It's gonna be in a rate, and sometimes you can open it up or other times people don't like to do that. It's just what you prefer to do. You just need to have the common separating each of the values. And I'm gonna see ah, blue and White. I like that combination. But we can also have an object instead of having blue and wait. I could just your object inside of this array. This you enter and I'm gonna have first through second. Wait. Didn't need to come in. So then you could also have off the objects inside of these arrays, and it could just go endless. Keep on making more objects and arrays inside of each other so you could have an infinite number of a raise inside of an array or an infinite number of objects inside of an object issues whatever you need to do to get your data. So I'm just gonna delete this, or we could also have animals. And I'm gonna put in pig, uh, dog she. So then you would be able to access all of these using the animals array, and then you could just call zero. And that would call return pig if you were in job script. 5. Course API Project: followers wouldn't in this lecture will be sure knew how to use an actual a p i to get your data using an A p I key. What we're gonna do is go to the movie database, not work. Okay, so now that we're here, we just want scroll all the way to the bottom and the a p I. So I've already created in a P I account, so I already have an A p I key. So look at your A b ikey, once you have your counter created and it will accept you automatically after you enter some information, so you would have to log in and create an account, But to see your baby, I keep you just hit your profile. So just hit that and then view profile. And then I am just gonna click on the settings, actually. Sorry. And then you're going to go to a PR and then, as you can see right here, is this a p I key? And this is versions three, which is what we're gonna be using in this. So the movie database. I should probably said this in the beginning. This is basically is all the information on all of these different movies and the actors and reviews. It has a lot of information on it that has the surveys that users conduce and it has information on all of them. So what we're gonna do is we're going to use their A P I key, and we're going to get data back in the form of J son. So this is our project that I want us to work on trying to learn how to use may be using Java script or python for some program. The language that you're able to use that can Dio calls you this female pages and get Jason data back requests. So on the documentation, we can see everything about the A P I. And so they also have a television show or add your images or other things. But we're just gonna be using this for the movies. So if I go to developers, the movie d b dot warg slash three and this will be the documentation and we're just gonna look into, uh, trending. Okay, so slash, training slash media type and then slash time window. Okay. And this is a get request. Therefore, we're just getting data If it's a post request that we're setting data, but this is just get so you just have to put in this route after the you are all. And you also have to include three. It's out of there, and then it will return the data. If you specify the a p a ki so we should be able to just copy there's can actually should cut this. Okay, Mission press center. Okay, so we have this, and then we're just gonna cut very pikey. And we're gonna do Was she Merck A B ikey equals, and then we're gonna pay Said it. You have to put in that, bro. And okay, it's like having the whole thing. Okay, there we go. Slash earning media type time window. So we're just gonna put in day for the time window, cause we can just do it for today. Some just gristle like this, and we're gonna put in day and then the media type we are going to put in movie cause we want to see the training movies. If we put that in there, you should be able to get her data back. Excellent. Gotten air, maybe. Okay, It's a B. I underscore Key, sir. She's in Camel case. Okay, We did something wrong. Turning movie day three AP. Okay, this is first A p I Okay, there we go. We got her. J son dated back. So this is Jason. All of this to a fine Copy this. And I put it in Jason prettier, and we're just gonna paces in here. We're gonna press me pretty okay? So we can see all of this. J son data she can see page one to This is if you wanted to have certain pages and you could use, uh, a page a nation to make it. So then it automatically loads in more pages, but then it does less requests. Your page will look, your website will load and faster. You can see the idea of the movie, the title of the movie, its average rating Vote count. And you can see these are all the different data types that we've learned. So this is a number. This is a brilliant. This is a number. This is also number. This is a string. This is a string. This is a string sharing array. The John R I. D. so he's probably specifies certain genre. Would you get also used loading in using the genres endpoint, which is right here. So then you can probably call using that genre I d. So then you could find out what the name of that Jonah is and a 1,000,000 other string, and actually this results is an array, an insider. That rate is an object. And then there's another object. Oh, so the page So it's page one and then results and results is an array of all of the different popular movies. So this is the most popular movie right now. Bad boys, really cause a in a rain is ordered. So this is zero. This one's too, and you can see how all of this data are. You could use this to create a website or looting it in. And so the project for you guys to do is I want to see, if you ask, can make like a website using this. It doesn't even have to be that good. It could just be like if you put it in the end point like website dot com, this could just be test, and then you could put in slash And then you could put that idea in. And then it would load all the information on that movie. But I just want you guys to make something using this a p I. And so I hope that you guys enjoyed this course. Um, please check on my YouTube and all of that. So those egos