How to extract json data in JMeter / How to use json extractor and debug sampler to get json data

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hellos how are you all welcome back to another video guys in this video we are going to see how we can extract the data from json extractor in the previous videos we would have seen how to do an api testing with parameterization how to extract the data from csv so now in this video we are concerned about this an extractor so without any further ado let us start the video [Music] so we have to go to add threads and thread group so in the thread group let me name this as json extract so in this i'll add a http request sampler so you can add json extract request json react request so now let us see one sample responses we have sample restate yes so as you can see i have entered sample rest api if you can come down we have i q r e s request a host address api ready respond let me open that so we have fake data which is not real data so we can take that api and we can use to our advantage so these are the list users if you want to click on it here the api is api slash users page 2 so just if you want to see the response what looks like so let me take this and i have to add it here so now you can see the response let me copy this response so this is the json formatter which we can use now this will format or beautify the response this is individual data you can see we have list of data for many users so this is a normal data it's not real data so that we can take this if you want to extract email and first name or last name whatever you want to extract from j meter we can extract from json formatter so now let me add a json format for this so i have to go to add i have to go to post processes in the post processes i have to add json extractor in its extractor let me give the variable let me write use so let me write path expressions if i want to extract if i want to extract let's say the first name from the first row of the data i can just write dollar dot dot and then id so if you want to only match the first one i have to give one so what if what is the default response if if we have an error right so i can write user not found now let me add one more thing you have to go to sampler you have to add debug sampler debug sampler will give you the results so you have to go to add and you have to add a listener now view result stream so now debug sampler will give you the results we will leave this the default parameters whatever are there in the deep bug sampler so let me go to view results 3 let me execute this so i don't want i don't want to save the test for now so now okay we see we got red y we didn't add anything right so let me go back to the url so we have to copy this url we go back to geometer paste it here so if you have seen my previous videos how to format the api so in the path you have to give this so protocol will be https now this will be req res dot in so let me go back to v registry let me clear the screen let me run it so now in the debug sampler we got the response see user is 7 so we have extracted the id so id is 7 so what if i want id first name and last name three things right so let me go back to json extractor so what only thing i have to do is i have to add an error right so let me add an array like this so let me copy this first name and the red comma and then i'll write a last name last name so i enclose this so if i want only the first one i have to give the first one itself i have to give one if i want to match everything right let me give minus 1 so if i give minus 1 i'll get all the results like this the first name seven michael lawson eight linsafe last name for rip sun it will get okay [Music] so let me go to view results three let me clear this run it don't have to save this debug sampler you can see um i last name we got lawson id we got seven first name we got michael for all the users so what if i want only the first one i just have to remove the minus go to registry remove this run it again so to debug sampler see the first name record michael lawson ident hope you have liked the video guys if you like the video please click on like if you're a new viewer please click on subscribe till then guys take care have a great day goodbye
Info
Channel: Azhar Techno Coder
Views: 5,962
Rating: undefined out of 5
Keywords: How to extract json data in JMeter / How to use json extractor and debug sampler to get json data, json extractor in jmeter, debug sampler in jmeter, how to extract json data using json extractor in jmeter, how to extract json data using json extractor, how to view extracted json data using debug sampler, jmeter json extractor, jmeter debug sampler, view extracted data using debug sampler in jmeter, how to view extracted json data using debug sampler in jmeter
Id: IsEumBz-tf4
Channel Id: undefined
Length: 6min 49sec (409 seconds)
Published: Mon Jul 04 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.