Postman Tutorial #15 - What is JSON | Send Requests with JSON Payload

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey everyone welcome back in this Postman tutorial we are going to learn about Json format what exactly is Json and how to send the postman request with a Json payload now briefly we have already understood and seen the post request with the Json format or Json file but before that let's quickly understand what exactly is Json when we say Json what exactly it means what type of file it is what is the format so you understand all of that before we go into the postman and see how you are going to use Json or or how you are going to send the request using Json payload okay so if I so I have already created a video on a Json format or or what exactly Json so this is the snippet from the same video but I'll explain everything again okay so what exactly is Json so Json is a lightweight data interchange format so basically say for example there are two machines or over the Internet how the data basically gets transferred from one application to another other okay so in order to transfer that data okay or interchange the data for example if you're on a e-commerce website say for example okay now on the e-commerce website or you are doing a registration when you do the registration you put your name your date of birth and other details address and everything right and you click on register how is all that information that you are putting the name and everything is transferred from your browser to the server right so these data interchange format which is Json XML is another one there are many others right so it is one of the file format to Interchange the data between the client and server or over the Internet or between two machines between two applications could be anything right if you go into the technicalities and detail there is numerous and massive possibilities how and where this Json is used so that's one of the examples now Json stands for JavaScript object notation right so it's a format it's a file format is another one which is for the data in the chain wherein if I'm doing a registration and I submit it the data can be transmitted as a XML file or Json but Json is much preferred over XML and there are pros and cons uh depending what sort of requirement in application and it's not about the preference basically the requirement of the application developers which format suits better okay now if you talk about the soap apis right rest will mostly use Json can also use XML soap will use mostly XML to Interchange the data okay so Json is a text format right and it is language independent what does it mean language independent it means that it doesn't depend on a specific language it's a format it's a file format that can be utilized by a program by an application developed in any sort of programming language okay it is easy for humans to read and write which will understand in a bit how easy it is to understand what exactly the key value pairs are read the file and understand all of it and it is easy for machines programs to parse and generate right so basically if I am creating a service a rest service okay and then I'll simply you know go ahead and or if if there is a program I can easily code write the code to generate the Json automatically and that Json gets transmitted so it's very easy to basically build and parse by the machines and computers and the program and Json is primarily built on two structures the value collection of the name and value pair and the ordered list so you have the list as well so this is brief about the Json Theory okay now let's understand what exactly or how the Json will look like so we had this post request which we understood previously right so if we go ahead and to the request post request and go to the body here right so in the body you will see in the drop down we have the Json and this is the file that we used to send right so this is the Json file or Json format basically in the name of in key value pair the information is in within the curly braces so this is a Json object one of the Json object within the curly braces which contains name and job right so this is the very basic Json format that we use to create a user okay using the post request to create a user with these details the name is RCV Academy and the job as trainer right so this if say for example I create a web application right so I'll use this particular API okay and my UI will have a field of name and a field of job a field of job wherein a person will enter those detail right so on the UI there will be a text box wherein I'll enter the RCV Academy I'll enter trainer in one of the text box which will be titled as job okay and then when I'll click on submit it will be something similar as sending this request what happens on submit of the UI it will basically formulate so programmatically the entries that you put on the UI will be formulated into the Json file and they'll be sent with this particular request will be formulated and will be sent like this file to the server okay so and then server if I click on send here okay you will see the server will then respond that the user has been created okay so you'll see this is the response this is the response from the server Okay 201 with the name the trainer the ID what is the new user that has been created what is the ID of it and when the user got created the timestamp for it so this is what the server has responded and you will see in the response as well by default the format postman has recognized that it's a Json format in the drop down you will see that it is automatically selected as Json because this is the Json format now let's quickly and stand the Json about what all key details need to be you need to learn about the Json okay so for example here I have this Json formatter okay now the Json object will have will be in the curly braces right so opening curly brace closing curly brace and within this Json object I can have the values as key value okay so for example company okay I'll say company I'll say string right so it has to be in code and then colon and the company name okay I can say RCV Academy okay now if I have another key value pair so comma separated I'll say location Australia okay so this is one very basic Json object okay if I click on format beautiful if there are any parsing error or anything you will see that I'll you will get a error here right so in this Json formatter it will automatically give you the errors so this is very basic Json format now within this particular Json I can have the array okay so for example uh there are multiple companies okay so now within this Json I can have employees okay so for example there will be many employees right so I can say employees all right and then there can be many employees and in order to have multiple employees the array starts with square bracket now within the square bracket you can have n number of employees okay so I can say name of the employee all right all right then let's just have the names okay now each of this object will be basically comma separated okay so let's have these comma separation here and let's change them okay so now you will see that this square bracket represents the array of objects within the Json right within the Json so a Json object this is the root object the whole object right and then within that there can be array of objects which is each of these objects four objects so if I simply format there is a little error there okay there is a comma required here okay so first attribute your second and then this is basically the third right so each attribute or key value pair that you see right each value in the Json format needs to be separated by comma so first second and then this is third which is array of objects right so last one is fine within the array again comma separated object okay so now you will see that this is basically how you are going to write a Json file and mostly you will be you won't be required to write it but in case you are required to write a Json file understand the Json file you know now that within the array how you are going to add the object what is the format key value pair right and then I can also have the for example these are all strings right but I can say I can also have the integer so I can say postcode is just integer okay so that integer won't be in the quotes there okay then I can have the Boolean as well okay so I'll say is active and a Boolean I'll say true okay format so what we have missed here is comma right and then comma again here so each line needs to be comma separated that we have understood right so you'll see now we have the postcode we have the Boolean value there right so it is all possible so string integers Boolean all right and then we have understood about the having of array of objects within the Json object right so you can have all of that nesting as well within the JS okay so this is briefly about the Json file what exactly is Json and where it is helpful then what all details you need to understand about the Json format and how you are going to use Json to send the request within Postman right so for example this post request in the body okay you simply go ahead and paste the Json right so we'll simply say for example we go in the body as this and in the body we simply say post paste the Json format and in the drop down you should just change it to the Json okay and it will show you a clear you know Json formatting and you send the request so that's how you are going to send the request with Json payload in post will understand everything in much more detail I am covering all of these Basics so that you build the fundamentals because once the fundamentals are strong you will find the advanced concepts very easy to learn okay so that's all for this particular tutorial I hope it was helpful thank you very much for watching
Info
Channel: Software Testing Mentor
Views: 9,815
Rating: undefined out of 5
Keywords: postman api testing, postman tutorial, postman tutorial for beginners, postman, postman api testing tutorial, api testing using postman, api testing tutorial, api testing postman, api response in postman, what is json, json file format, json file tutorial, json payload postman, json payload example postman, postman json, postman json file, postman json post request, how to send post request in postman with json
Id: TNw7askgUiU
Channel Id: undefined
Length: 10min 33sec (633 seconds)
Published: Wed May 17 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.