Udemy

Introduction to XML & JSON

A free video tutorial from Sashi R
Learn Smarter, Achieve Better.
Rating: 4.5 out of 5Instructor rating
3 courses
15,183 students
Introduction to XML & JSON

Lecture description

In this session, I will give you a brief introduction about XML.

Learn more from the full course

Rest API/Web Services testing with SoapUI+Realtime scenarios

#1 Highest Rated Soap UI Course- 9000+ Students ::API Testing+Groovy script+Real time Project+ Interview Questions

09:51:56 of on-demand video • Updated November 2022

Writing test cases for SOAP/RESTFul APIs/Web services.
Writing automation scripts using Groovy
Preparing test data using excel sheets
Importing REST project from Swagger
Sample projects with web services for practice purpose
Managing environments in SoapUI Free/Pro versions
Generating test reports
Interview Questions
Understand database(MySQL) basics
Continuous Integration (CI)
Creating automation scripts to execute test cases from build tools on different environments
English [Auto]
Hi. Welcome back. In this small lecture, I will try to explain what is XML and what is Json and why we need them. Okay. The main purpose of XML and Json in web services. Well, so we all know that there are two kinds of web services available as of today. One is soap based web services. The next one is RESTful Web Services. We also call them as restful APIs. Okay. The soap based web services, they communicate through XML messages means they send the request as an XML message and they receive the response as an XML message. And similarly the rest API, they communicate through either XML or Json. The request can be anything. It can be a get request, a post request. There are different types of. There are different methods that we use while calling a rest API which you can which we will cover in our rest API topics. But the response which we get from rest APIs is either XML message or a Json message means as a tester, when you are writing assertions, you need to understand. What is the response of the Web service? And based on that, you use different types of assertions. If it is an XML message, we use XPath. If he is Json messages, we use Json path assertions which we will see in the assertions section. Well. Let's take a simple example. Here is the data, which is coming back from a web service. Now, can you tell me what is one, two, three, four, five, six. What is John? What is doe. Is there any meaning for this data? What do you see on the screen? At least some of them you can understand. But you really cannot make anything out of this information. Right? Now, let us take a look at this one. Now, is this data looking a little bit meaningful? All right. So what I have done here is I have wrapped my data one, two, three, four, five. Whatever we have seen in the earlier slide, I actually decorated this data with this tags. Right? So by looking at the tag as a human being, I can understand that this information is all about a customer. How will you know that? By looking at this, you can tell that this information is for a customer. And. Whereas one, two, three, four, five, six is the customer ID, John is first name, Doe is last name, and so on. Australia is the country so means we are actually giving a meaning to the data. XML does the same thing. Now when the web services are communicating. The guy who is receiving the XML response from the web server web service. They need to interpret the data. And extract the data what they need. So let's say if I'm getting the response back from like this, I want to extract the city. But from this, how will I know that Sydney is a city, right? And unless I decorate it with a tag, this is called XML tags. Okay, so. Basically this is called meta information. An XML stands for Extensible Markup Language. Okay, so we will mark up the data with meaningful. Elements, we call them as XML elements. This is how an XML looks like. Similarly, if I want to represent the same information in Json. Assume that the web services is a restful API and it is sending back the customer information. It looks something like this. Is it also looking? Meaningful, right? But here the data format is a little different. Where I use in XML, we use XML tags and here we use. Attributes, but the representation is a little bit different here. They use curly braces and customer ID colon one, two, three, four. As long as. The data has a meaning, then your application can understand the information and it can show it. It can process the data inside it. Got it. So this is how a Json data is represented. All right. So similarly, you can take some other examples from Internet. Okay. Let us take a small example. Well, I went to one sample Web service website where we can look at some Json sample. Right. So now here you see here, if you don't see this meta information and if you say Apple, large red, there is no meaning. Right? And if you take a look at on the left hand side fruit, so apple is a fruit and large is a size of the fruit and red is the color of the fruit. So this is how we give meaning to the data by providing meta information. So Json will be represented like this. Now, if I take a look at this, right, it says quiz. So this all the information, whatever you see here, is all about a quiz and it's about sports. And this is Q1 is question one. This is a question and the question. Description is which one is correct. Team name in NBA. And this is all the options. Of course, this is a little bit complex Json, it has more data, but as long as you have a meaningful. Meta information so anyone can understand. So now can you tell me what is the options for question one by looking at this tag? So this is how the web services uses either XML or Json to exchange the information so that they can extract the information out of them by using the meta tags. Okay. So as a tester, when you are adding assertions, you should use either jsonpath or XML path. To extract the information and to assert the values. All right. Well, that's all about XML ingestion. Let us catch up in our next topic. Thank you.