What is JSON ?

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
Jason or JSON it doesn't matter how you pronounce it what matters is what exactly this means now again there are lots of people they do pronounce it as JSON and officially it is pronounced as Jason but is it that doesn't matter what matters is what exactly it means again for this for this video I will refer that's Jason you can you can say that's whatever you want but then let's let's name it as Jason now Jason basically stands for JavaScript object notation and why it is so famous as you can as you have heard about Jason before it is used in Android it is used in web technologies rest api is it is used everywhere right so what is Jason and how to use it so in this video we are going to talk about this thing welcome back aliens I'm now in the different icicle earnings and let's get started so as we have defined Jason simply means JavaScript object notation so when you talk about Jay when you talk about Jason the full form is so it simply says JavaScript object notation right so of what happened you know when you talk about Jason it is simply a format in which you can transfer data from client to server and from server to client C in the initial days of web development we used to work with HTML white hTML is like the what is a de facto design pattern so everywhere we used HTML to design websites and we don't have any other choice other than we use CSS then we use JavaScript so initially we used to create static pages but now the world is changing right we are making more dynamic pages and when you say dunnock page it just simply means that the data which you get from the server will be dynamic or on the de pon your request you will get the response example a typical example would be if you go to any web site like Facebook so on Facebook what happens is you have a mobile application and then you have a website right so all you'll be having a server so this is your server and this is your application so what we do is we send a a synchronous request now if you don't know about X asynchronous that that's ok what it simply means is your view have opened a app or the website on your while phone what you're doing is after some time your website is sending a request to the server and in response your server is sending some data now this data can be in any format ok now normally we talk about websites you return HTML format but in addition of returning an HTML format you can also return something or you can also return only data example let's say if you have if you have any object on server side because data are coming coming from data from servers right now it doesn't matter which which technology are you working on server side maybe PHP Ruby Python Java you can use oh maybe maybe P ok so the technology which you can use on server maybe it is Java maybe asp.net maybe PHP doesn't matter what matters is from this server what you written on the client side would be only data because sometimes it happens you know you have a application here you don't have a website but then you have application now in this application you already have a design what you don't have is data so this data will be coming from a server now when you send a request you will get a response in some format right I don't want HTML because HTML will give me the design as well what I want is on the data so what can be used here so can be used text plain text something like this when you when you get data you can also return text or plain text we can do that right we can send the data from server to client in text in train format but we just have one issue here the issue is when you send data in a text or plain format it will be difficult for you to pass it here say when you send HelloWorld that's fine right when you send data like I am loving ready that's fine but the moment you send some complex data and we are living in object-oriented world right when you get you don't send simple data you send complex objects example let's say if you want to send our information about employ again so this is a very typical example right when you talk about a database system or thing so when you talk about the employed self-employed we'll have certain things right so let's say if you have this employee object this employee object will have certain properties maybe employee will have employee ID then employee will have employee named employee will have a salary and employee will also have the department so which department and employed belongs to right so this is not a simple object now this is a complex object so what you want to do is you want to send this object in your in your application so that you can read it here now when you send a plain data it's very easy to read write hello world my name is Naveen ready but the moment you send this complex data problem starts here I mean you can send it in text format that's not an issue how will you pass it here how will you fetch one one value because you are sending a string then on the client side you have to write Java for yours right PHP code any I mean JavaScript code and you have to take out one one element it will be a I mean you have to do lots of programming there what if you can have a object-- format here so you know we when talk about JavaScript in JavaScript we can a JavaScript object we can create an array so what if you can directly send this data in the object format itself maybe a JavaScript object and that's what is called as JavaScript object notation right because what you sent is not a plain text but something in a format which will be readable by your JavaScript which will be readable by your by Java code as well and you can imagine this you have a Android application here okay and then you have a java application on server nobody is a java application maybe sublets maybe sublet spring technology doesn't matter maybe rest api so when you have Java and Java because Android is also Java right so when you have Java on both this side instead of sending a plain text what you can do is send this object ok Java object here in the idle application but then how can we send object so what you have to do is we have to size the object now when you accessorize the object it simply means fetch the values of an object put it in somewhere and send that something to the client side and your client will read that and your client will be able to pass it I mean that's awesome right if it is possible only when you send data in a JSON format so that means you have to convert this into JSON format so how do we do that so let's say shop saying employee ID let's refer this as e ID so let's say the e ID is 1 then your name is something you can say Naveen and then your salary is this 6,000 and department is education right so if you have all this value so we have a ID 1 a name Naveen and salary 6,000 Department is education you will send this information on the client side in some format and that will be Jason now let's represent this in here so let's write Jason so we say e ID equals show in double quotes 1 that's mighty ID then give a comma so you have to open a context close bracket you have to give a comma then you have to say a name equal to in double quotes you have to say Naveen and then again comma is important that right and then you will say salary equal to in double quotes 6000 then a comma and then you have to say Department is equal to oh it's not - its : how can I forgot that we have to make sure that we put a colon there okay that's a collection and then we have to say education so that will be education here right so we have e ID : 1 e ID : Naveen and then this goes on now this data you are sending on service anyone clients idroid some clients that you can read this data now if you're using javascript is very easy if you name this object as employee let's say if you create a variable in JavaScript when you say Brad EMP when you open the curly brackets and if you have this data so this data will be coming from server it will be assigned to EMP now what you can do is you can simply say e MP dot e name he MP dot salary this will work now you might be thinking okay working with JavaScript with Jason is easy how about Java code what if you want to do in Android so in Android we create Java objects right so that means from Java object which is this let's say this object name is EMP itself which is e MP class EMP object if you are sending this op check in JSON format that means you have to convert that object or JSON format right and on the client side you have to convert your Jason into Java object so I want to convert so I want to say I'm going to do something like this I want to convert an object in Java to Jason and then on client side I want to convert this Jason into object okay now how do we do that so don't worry there are certain libraries available example Jason we have Jackson so all these libraries are available and you can use any of the slab way to convert your Java code into Jason and Jason into Java object it's that easy but then Jason is the only way to do that all ok let's have one more thing what if you have object inside an object now maybe you have a collection inside the object example under this employ this employee has how many mobile phones maybe you can have this example right so maybe a Salesman how many wild phone brands is sales so we'll be having the least of mobile phones right because you will not be having one mobile phone you will be having these two mobile phones and let's say if you have three mobile phones how will you send data here so again you have to say Mobile's and whenever you have a list we give a addressing button of any member we have added so we have to open the array we have to close the add it in this array will be having all this values that means Jason is an object and inside this an object you can have an array object now the amazing thing is inside this array object you can also have adjacent object so maybe mobile phones will be having its own object so we can open the curly brackets and you can have the first mobile phone data here then second mobile phone data here that is that awesome so object JSON object can have Java added or JSON array jason add a can have JSON objects and Jane again that is no object in have java jackson jason add it's like Inception right but then okay that's how it works it's it's quite simple the only problem is when you generate this data by yourself you might have to write it on Google so if you just go to Google and search for Jason why data just paste your Jason there it will give you what's wrong and watch right so that's that's an awesome thing but then oh is the easy to only option you have Jason can use something else and what what we were using before Jason because Jason came I guess in last five years and I am Not sure but then what about what what before that what they used to use so before Jason people used to work on XML so when you want to send data from server to client they used to ex use XML in fact now also people do use XML but then Jason is trying to what you say was right the XML features so whatever you can do Jason you can do an XML so why to use XML when you can when you can use Jason so Jason is a very standard format now in fact if you follow all my tutorials on on richest API or maybe on spring rest will be using Jason there so the idea behind this video is to make you understand whatever we are going to do in rest api this is the foundation for that so just remember Jason is a format from which so this is the format using which you can send data from server to client and from client to server as well when you want to post data you can also use Jason right so that's that's an awesome thing so this is how it looks like and that's you will be sending date data but how to make it work that we'll see in the practical video of REST API so that's it I hope you enjoyed this session that click on the like button there and do subscribe if you have not done yet thanks so much
Info
Channel: Telusko
Views: 909,832
Rating: undefined out of 5
Keywords: telusko, navin, reddy, tutorial, java, json, javascript, object, notation, rest api, restful web service, soap, webservice
Id: JuFdz8f-cT4
Channel Id: undefined
Length: 11min 55sec (715 seconds)
Published: Mon Jun 26 2017
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.