How to parse dynamic and nested JSON in java? - Rest assured API automation framework

  Рет қаралды 121,588

Fun Doo Testers

Fun Doo Testers

Күн бұрын

Rest Assured is very popular in API Test Automation. REST Assured API can be used to invoke REST web services and match response content to test them. This video is about how we can parse JSON data to Java Object where keys are dynamically created.
✅ In this Rest-Assured video, we will be learning,
1. How to parse dynamic JSON?
2. How to parse nested JSON?
3. How to write a recursive Code?
4. Code debugging.
🔥🔥🔥 In Hindi: • How to parse dynamic a...
🔥🔥🔥 One to One connect with Fun Doo Testers : topmate.io/fun...
✅ If you like my videos, please consider buying me a coffee: www.buymeacoff...
Good books to read :
✅ Head First Java: amzn.to/2ZQlXqI
✅ Cracking Coding interviews: amzn.to/3bDX8Un
✅ For business write us on: Contact@fundootesters.com
✅ Say hello to us, and stay updated!
Facebook: / fundootesters
Instagram: / fundootesters
LinkedIn: / fundootesters
Blog: / fundootesters #Restassured #API #fundootesters
GitHub: github.com/Fun...
GEAR USE:
○ My Camera: amzn.to/3e2UqL7
○ Microphone: amzn.to/3bSUvOq
○ Microphone:amzn.to/2ZXuo3s
○ Tripod: amzn.to/2PqmTQN
DISCLAIMER
Links included in this description might be affiliate links. If you purchase a product or service with the links that I provide I may receive a small commission. There is no additional charge to you! Thank you for supporting me so I can continue to provide you with free content each week!
#Json #RestAssured #FunDooTesters

Пікірлер: 256
@naveenbv1838
@naveenbv1838 4 жыл бұрын
Hatsoff man 👍Really cool stuff which I was looking for . Thanks a lot for your effort🙏
@FunDooTesters
@FunDooTesters 4 жыл бұрын
Glad to hear that
@manalijedhe7729
@manalijedhe7729 3 жыл бұрын
How to remove jsonArray from JsonObject?
@ensarbati5271
@ensarbati5271 2 жыл бұрын
You are the man! I have been struggling with this exact context over 20 hours. Finally some who goes through every step with explanations. Thanks a lot!
@FunDooTesters
@FunDooTesters 2 жыл бұрын
Wonderful
@vijayendranvijay4538
@vijayendranvijay4538 Жыл бұрын
​​@@FunDooTesters very useful info... But I have a json file in below format { "name" : "vijay" "dob" :"1991" "JsonString" : "/n com.api.getid" {_id :123/r/n ; _fc: abc /r/n ; comp [{ _compname : abc] } "no of instance" :1 } I need to update the id value inside the json string to 345 and write the entire contents back to the json file... Can u pls help on this? I tried updating the id value by traversing to json string - >com.api.getid but when writing back to json file other contents like name, DOB and no of instance go missed and only the json string gets updated into file but unfortunately without the escape characters and line feeds.. Pls help on this
@manishpatidar5379
@manishpatidar5379 3 жыл бұрын
One of the best tutorials ever found on internet on api...really appreciate your efforts.
@FunDooTesters
@FunDooTesters 3 жыл бұрын
Glad you liked it. Such comments give strength to create more videos 🙏
@mfs1316
@mfs1316 2 жыл бұрын
top class,all youtubers are just validating status becz its easy ,no one is teaching how to parse body becz its difficult even they dont know,after searching found this gem
@FunDooTesters
@FunDooTesters 2 жыл бұрын
Glad to hear that. Stay tuned with us for amazing content
@udemytesters
@udemytesters 3 жыл бұрын
OMG......I browsed for days for this content but no luck until i get this.No one has provided this so far.. you are awesome Sir....
@FunDooTesters
@FunDooTesters 3 жыл бұрын
Glad you liked it 👍🏻 Stay tuned with fun foo testers for more fun and learning
@ggmushorts
@ggmushorts 2 жыл бұрын
Thanks for the series of Rest Assured, just a suggestion as you can add more video under this series which can cover more topics such as :- Handling with more number of complex JSON :- Executing number of @Test using tesng.xml format and segregation of in terms of sanity, smoke, regression,etc :- Different types of authentication handle :- Handling of cookies :- Handling and validating using JsonPath :- XML file handling :- Handling of sessions :- Cover more real-time scenarios
@FunDooTesters
@FunDooTesters 2 жыл бұрын
Glad you liked it. Sure Suryakant I’ll try to cover these topics after ongoing series
@sridharraju3249
@sridharraju3249 3 жыл бұрын
Great work Nishant! Expecting more Java videos like this scenario from you! thanks :)
@FunDooTesters
@FunDooTesters 3 жыл бұрын
Glad you liked it. I’m planning for new series on java after completing current on software testing. Stay tuned with fun doo testers
@sumiranraut8845
@sumiranraut8845 3 жыл бұрын
@@FunDooTesters Hi Sir can i have one video where we compare two API Json Response and print the difference between them if any. Thanks in advance
@markthomas9641
@markthomas9641 2 жыл бұрын
Great explanation, thank you. If you are a developer working with JSON then DeltaJSON is really useful, it has an API for compare, merge and graft.
@FunDooTesters
@FunDooTesters 2 жыл бұрын
Glad you like the explanation. I’ll take a look of daltajson. Thanks for the suggestions
@samirangelgmit
@samirangelgmit 3 жыл бұрын
Great, really appriciated for all your efforts...One of the best trainer🤘 keep posting more n more
@shwetaoberoi6044
@shwetaoberoi6044 2 жыл бұрын
very nice logic. It really reduced the POJO classes and its logic . Thanks a lot.
@yoshitamahajan353
@yoshitamahajan353 Жыл бұрын
Thank u so much I used to never understand json thing bt this video helped me a lot!!!
@ganeshmynampati1607
@ganeshmynampati1607 2 жыл бұрын
I have been searching for this since longtime. Finally got it. Thanks a lot and a very nice and clean explanation too.
@FunDooTesters
@FunDooTesters 2 жыл бұрын
Glad it helped
@testqaa1626
@testqaa1626 4 жыл бұрын
Really good. I was looking for this. Thank you sir
@anupkapale7953
@anupkapale7953 4 жыл бұрын
Hi Nishant, Thanks for this utility, Your videos are very helpfull to get the knowledge of java as well as rest assured. Just wanted to one concept here. As once of the json format had array with two objects where the name was choc cake and Ice cake so it was capturing both the values, here i need to capture the only one name as "choc cake" so how i can capture that value by using this utility. Thanks again for helping the testing community.
@FunDooTesters
@FunDooTesters 4 жыл бұрын
Hi Anup, Thanks for watching video session. I understand your concern, have small doubt. On what basis are you capturing choc or ice cake? Are you referring from somewhere?
@vaishalichavhan4536
@vaishalichavhan4536 2 жыл бұрын
I am getting error as below when I use JSONObject j=new JSONObject(request) .request is a string containing JSON. How to resolve it. please guide. JSONObject(java.util.Map)' in 'org.json.simple.JSONObject' cannot be applied to '(java.lang.String)'
@aniltamhane5499
@aniltamhane5499 3 жыл бұрын
Excellent...I was looking for this stuff for long time 👍👍
@FunDooTesters
@FunDooTesters 3 жыл бұрын
Glad you liked it. Stay tuned for upcoming courses
@rameshgaming1020
@rameshgaming1020 3 жыл бұрын
Excellent stuff man!!! hats off!!! you just made life simple...
@abhisheks2505
@abhisheks2505 2 жыл бұрын
Thanks for sharing your knowledge. Much appreciated :)
@tanunesta
@tanunesta 2 жыл бұрын
Thank you so much for sharing your knowledge with us! God bless you!
@FunDooTesters
@FunDooTesters 2 жыл бұрын
Glad you liked it. You are so kind
@delarcro
@delarcro 3 жыл бұрын
Really great implementation
@julissamendezangeles
@julissamendezangeles 2 жыл бұрын
Thanks a lot for Sharing , great examples and code
@monalishapradhan1495
@monalishapradhan1495 2 жыл бұрын
Great stuff!!!! Thanks for sharing 😀
@saurabhsanyal4218
@saurabhsanyal4218 Жыл бұрын
It's 4 in the morning just want to thank you, can I buy you a cup of coffee?
@FunDooTesters
@FunDooTesters Жыл бұрын
You are too kind. Glad you liked it
@suhailakhtar1707
@suhailakhtar1707 2 жыл бұрын
this video is very helpful. thanks bhaiya!!!!
@FunDooTesters
@FunDooTesters 2 жыл бұрын
Thank you 🙏
@shubhamsharma-mt4hs
@shubhamsharma-mt4hs 3 жыл бұрын
if i want to print a particular object value how do we do that? for example in complex json string that you took in the end i want value of count of 8911 object
@sanutsk
@sanutsk 25 күн бұрын
Hello Sir, Good Evening Can you please share me the link where I can get these complex JSONS whatever you have used in this video. It will be very helpful for me while doing the practice.
@sakshiaggarwal6199
@sakshiaggarwal6199 2 жыл бұрын
Thank you so much for sharing the informative content!!
@FunDooTesters
@FunDooTesters 2 жыл бұрын
Glad it was helpful!
@testsaucelabs6997
@testsaucelabs6997 3 жыл бұрын
I was looking this. Thank you sir
@flight_of_phoenix
@flight_of_phoenix 3 жыл бұрын
Awesome stuff
@jayantagarwal6339
@jayantagarwal6339 3 жыл бұрын
thanks, sir @Fun Doo Testers
@amir208501
@amir208501 Жыл бұрын
Thank you for sharing. This is great! I have a question though, how can I make it to return a list? Making getKey() method to return a list. That would be very helpful.
@SoltLikeThis
@SoltLikeThis 3 жыл бұрын
Thanks a lot, man! Great job, it helps me a lot.
@FunDooTesters
@FunDooTesters 3 жыл бұрын
Glad to hear that!
@nguyenquan4836
@nguyenquan4836 Жыл бұрын
Thank you so much!
@Lakshmisridhar
@Lakshmisridhar 4 жыл бұрын
Thanks for this code really great, how can we return the values of keys, because of recursion return is not properly working, can you please help to add return type to getKey method.
@FunDooTesters
@FunDooTesters 4 жыл бұрын
I was waiting this question. Loved it. You have to create static method outside of the getKeys methods. Store all the values and then use it. By the way ill soon upload video for the same.
@jagadishkounder96
@jagadishkounder96 4 жыл бұрын
Waiting for the same bro..
@shashwatkatiyar1377
@shashwatkatiyar1377 3 жыл бұрын
Hi, When will you upload the video ..Please help us
@ivangoh4883
@ivangoh4883 3 жыл бұрын
@@FunDooTesters Hi, may I know if you have the solution for this? Thank you.
@bhagyashreenavarkar8656
@bhagyashreenavarkar8656 2 жыл бұрын
@@FunDooTesters Did you upload video for the same?
@me.nilesh
@me.nilesh 4 жыл бұрын
Thanks mate! Very helpful
@FunDooTesters
@FunDooTesters 4 жыл бұрын
Glad it helped!
@haribabuvelakavaram5935
@haribabuvelakavaram5935 4 жыл бұрын
Hi Nishant... Have a question. If you see the video at 26th min, the line number 32 and 42 have if conditions. But from the first if condition i.e, line 20 we have got the exists value as false....so what is the use of writing if conditions at line 32 and 42?? Please clarify...
@FunDooTesters
@FunDooTesters 4 жыл бұрын
Yes you can remove inside if condition
@haribabuvelakavaram5935
@haribabuvelakavaram5935 4 жыл бұрын
@@FunDooTesters thanks for a very quick response... glad I found this channel. .much love.
@vineetnt
@vineetnt Жыл бұрын
Really good explanation !! using this approach can we update some parameter values in the nested json at run time? and will it return the complete json body along with new updated values?
@FunDooTesters
@FunDooTesters Жыл бұрын
Glad you liked it. I guess no. Let me find a solution. Will revert shortly. -Nishant
@jayantagarwal6339
@jayantagarwal6339 3 жыл бұрын
If there're two keys of the same name, then it's reading the value of the first key only (tried in my json). So, Can we read the value from the second key also? For e.g. @ 18:36 , if we do not replace "seq" with "fundootest", then can we parse(read) the value of this particular "seq" which is "1" rather than the one which is already available on the top of it having the value "2". thanks!
@rakeshs277
@rakeshs277 3 жыл бұрын
Really help method.
@yashpalwaghmare1701
@yashpalwaghmare1701 3 жыл бұрын
This is one of the best video I have seen, excellent explanations. Could I get the git repo url for this.?
@FunDooTesters
@FunDooTesters 3 жыл бұрын
Thank you liked it. Please consider subscribing channel and share with friends too. I will be appreciated. Here is a github repo: github.com/Fundootesters/RestAssuredFramework
@yashpalwaghmare1701
@yashpalwaghmare1701 3 жыл бұрын
@@FunDooTesters Thank you, sure I will do that.
@yashpalwaghmare1701
@yashpalwaghmare1701 3 жыл бұрын
@@FunDooTesters one thing here which is failing for me, in JASONArray loop it is failing it is trying to convert a single value to JsonObject. Can u plz help me on this.
@FunDooTesters
@FunDooTesters 3 жыл бұрын
Did not get you. COuld you please share more details?
@ravipathak2217
@ravipathak2217 2 ай бұрын
Hi @Fun Doo Testers thanks for your videos its really helffull. But i need one help. I have one jason in which i want to traverse with key and replace its value and return the json with new replace value. Using your code i am getting only the current node json value not full json. Can you make one video on my issue. Thanks
@anuvarshini5116
@anuvarshini5116 4 жыл бұрын
Hi Thanks for the utility,it was well explained. However can you upload a video of how to pass TestData using Excel - Apache POI API
@FunDooTesters
@FunDooTesters 4 жыл бұрын
Thanks for watching video. I will upload in sometime. Meanwhile stay tuned with us
@adityakashyap6765
@adityakashyap6765 Жыл бұрын
Can you make a video on updating the value for dynamic json?
@yelloverz5537
@yelloverz5537 4 жыл бұрын
Sooper cool... But it is more better if you can adjust the subtitle... It will improves the readability..
@FunDooTesters
@FunDooTesters 4 жыл бұрын
Sure i will update
@rameshanantha6280
@rameshanantha6280 10 ай бұрын
Hi Anna Method is not working fine when we return the value instead of printing it Can you please help on it
@kaydyach89
@kaydyach89 Жыл бұрын
Thanks For it. Its really amazing utility. But while using it I have problem. I have dynamic json with multiple nested json object, json arrays and I want to check each key and want to check which key have NULL value as I need to pass the same json to downstream application without null pointer exception. Could you please give your input. Thanks in advanced.
@yelloverz5537
@yelloverz5537 4 жыл бұрын
I have one doubt regarding this. I have linked hashmap instead of hash map in my json, but iam not able to do the keys operation on the object.Why?
@FunDooTesters
@FunDooTesters 4 жыл бұрын
Hi Gijo, Not able to understand, Could you please elaborate . Apology for late reply.
@bathulanagendra4621
@bathulanagendra4621 4 жыл бұрын
Hi sir, Video was very much informative,and solving real world scenarios in JSON Formatting. If possible please share source code ,it will be much helpful.
@FunDooTesters
@FunDooTesters 4 жыл бұрын
Hi Bathula Nagendra, Glad you liked it. Please find source code: github.com/Fundootesters/RestAssuredFramework/blob/master/src/main/java/utils/ParseDynamicJson.java. Stay tuned with fun doo testers.
@bathulanagendra4621
@bathulanagendra4621 4 жыл бұрын
@@FunDooTesters Thank you so much sir for sharing code.
@RahulSaini-ji1pn
@RahulSaini-ji1pn Жыл бұрын
Thanks Nishant @Fun Doo Testers for the amazing solution; it helped me a lot. But I'm having one query here. Until parsing the json, this logic is fine, but after finding it if we want to update the value of that same property and want to get the whole json returned with the updated value as a string, how can I make it possible using this code?
@FunDooTesters
@FunDooTesters Жыл бұрын
You can write store values in desire collection like list or hasmap even pojo will work
@durveshbhole9
@durveshbhole9 3 жыл бұрын
@Fun Foo Testers -> How can I get two keys at a time from such deep nested json ? For example I want the output to be in below format: [{"id": "someid1", "name": "Test1"}, {"id": "someid2", "name": "Test2"}.....] and so on..
@bapusoumya1
@bapusoumya1 3 жыл бұрын
Really Good!! Keep it up :)
@FunDooTesters
@FunDooTesters 3 жыл бұрын
Thank you
@yogeshnipate
@yogeshnipate Жыл бұрын
Hey Thank you for your wonderful explanation , Could you please share dependency you have used with version ?
@FunDooTesters
@FunDooTesters Жыл бұрын
Hey Yogesh, glad you liked it. github.com/Fundootesters/RestAssuredFramework
@ArunRajput-ut7gt
@ArunRajput-ut7gt 4 жыл бұрын
brother unable to import org.json.JSONObject as it gives error "A JSONObject is an unordered collection of name/value pairs. Its external form is a string wrapped in curly braces with colons between the names and values, and commas between the values and names." something like that
@FunDooTesters
@FunDooTesters 4 жыл бұрын
Please add correct dependency mvnrepository.com/artifact/org.json/json/20200518
@rajesho9772
@rajesho9772 3 жыл бұрын
Good one bro
@sandeepb6253
@sandeepb6253 4 жыл бұрын
HI Nishanth , I followed your lecture , i was able to read the json . Can you please help , if i get values for a particular key for example same key 5-6 values .I want to store values in ArrayList Please help
@FunDooTesters
@FunDooTesters 4 жыл бұрын
Hi sandeep, Thanks for watching video. To store values in a Array List you can create this method as a return type ArrayList and whatever you are getting as a parse result, those data you can add to arraylist. Thanks
@keepsmile564
@keepsmile564 3 жыл бұрын
Very good.
@surwase1
@surwase1 3 жыл бұрын
Great Tutorial!. Can you create video on how to update any field in JSON on the fly?
@FunDooTesters
@FunDooTesters 3 жыл бұрын
Yes I will
@nareshkeeplearing655
@nareshkeeplearing655 4 жыл бұрын
Hi sir am new to API testing. Recently in one interview I was asked how do you validate get response ( dynamic response). Example send get request to find out number of Samsung phone in Portal but the result will change dynamically every time. How do you validate the result. Please help me with this query
@FunDooTesters
@FunDooTesters 4 жыл бұрын
This video is the best answer for your question. Please watch and try it with different types of json data. Feel free to reach me if you have further queries
@pareshmkulkarni
@pareshmkulkarni Жыл бұрын
Do we need 'if' condition 'exists==False' on line 32 and 42. It is already verified on line 26. Please comment on need for additional condition....
@hdkloh6857
@hdkloh6857 3 жыл бұрын
Why don't you use Hashmap instead? esp for the dynamic json objects
@FunDooTesters
@FunDooTesters 3 жыл бұрын
Hashmap also we can use
@qibbs8934
@qibbs8934 Жыл бұрын
Is it possible to exclude the method from parsing certain arrays?
@viratsuresh5946
@viratsuresh5946 Жыл бұрын
Json string to java object conversion. But my java object has map in it along with other variables. Map In that case how we can achieve it.
@FunDooTesters
@FunDooTesters Жыл бұрын
Key= employee object I’d Value= employe object. If you can share complete data I can help
@pradhyumnakandamuru
@pradhyumnakandamuru 3 жыл бұрын
What should we do if the object inside of the JSONArray is not having a key to it, how do we fetch it?
@pankajmodi426
@pankajmodi426 Жыл бұрын
bro i am using this code but getting lots of error, JSONObject.has(); json.keys(); etc having error ,,,plz suggest proper library
@vikrantmukkawar9737
@vikrantmukkawar9737 3 жыл бұрын
Nice Tutorial can you make video on java object to json using GSON for nested object and array with some complexity
@FunDooTesters
@FunDooTesters 3 жыл бұрын
Will upload soon
@pragyanmishra-fl2vx
@pragyanmishra-fl2vx 2 ай бұрын
please provide these nested json files you have used. it will help me while learning on my eclipse IDE.
@shameem132
@shameem132 4 жыл бұрын
Please tell me how to create dynamic function to update the jaon value in json file..thank you in advance...
@FunDooTesters
@FunDooTesters 4 жыл бұрын
What's the reference of dynamic JSON, you can create a pojo of entire schema, after you can serialised or de serlialise data based on your need.
@mattrex002
@mattrex002 2 жыл бұрын
I am not able to get some of the static methods that you are using when I used the simple JSON from Google
@FunDooTesters
@FunDooTesters 2 жыл бұрын
Checkout pom github.com/Fundootesters/RestAssuredFramework/blob/master/pom.xml
@ashwinikantule146
@ashwinikantule146 2 жыл бұрын
Thank u for the code, can u pls explain how to pass multi form data with complex json objects to rest api.. Thanks
@FunDooTesters
@FunDooTesters 2 жыл бұрын
Loop through list/map to pass data.
@ajaiyapandey5058
@ajaiyapandey5058 4 жыл бұрын
Hi Nishant, Thx for this lecture . Can you explain how to remove all attributes from the JsonObject if that contains as some specific value or empty or null value present ?
@FunDooTesters
@FunDooTesters 4 жыл бұрын
Hi Ajaiya Pandey, thanks for watching the video. In this case first you have to validate null/specific values using iterating entire json. and then you can remove that attributes. .remove() method is available for the same.
@senthilrr8742
@senthilrr8742 2 жыл бұрын
Hi Bro.. excellent tutorial for reading the complex json reponse... need your help... could you please let me know how do we update the json file which nested like the one in complex example jsoninput
@FunDooTesters
@FunDooTesters 2 жыл бұрын
Sure will add soon stay tuned
@payaljindal1621
@payaljindal1621 6 ай бұрын
Hi Fundoo will u pls help with my JSON as it is little different from yours and parsing root is also different
@FunDooTesters
@FunDooTesters 5 ай бұрын
Please share take a look github.com/Fundootesters/RestAssuredFramework/blob/master/src/main/java/utils/ParseDynamicJson.java once
@vinothvijay85
@vinothvijay85 2 жыл бұрын
I have a scenario where i want parse the jsonobject and if id matches (i.e 123) i need to replace the name (ggg) . Input : [{"id":123","name"abc"},{"id"456":"xyz"}] and the output i'm expecting is [{"id":123","name"ggg"},{"id"456":"xyz"}] . I dont want to use to string replace . I need to parse and update the value.
@FunDooTesters
@FunDooTesters 2 жыл бұрын
Consider your json as a array. You need to iterate over json. Each element will give you json object. Just check Getting desire id values or not. Org.json lib will help you here
@ivanbagsit1709
@ivanbagsit1709 2 жыл бұрын
May I ask how this can be used to update an element and return back the original JSON with the updated element? thank you very much!
@FunDooTesters
@FunDooTesters 2 жыл бұрын
Use jsonpath
@ajaykumar-xy6pw
@ajaykumar-xy6pw 4 жыл бұрын
Can we use blob and clob objects in the json response as well, will it work with that as well?
@FunDooTesters
@FunDooTesters 4 жыл бұрын
So you mean to say value as a blob? Or how it will be? If in key value pair value will be blog then finally it will be string. In this it will work
@ajaykumar-xy6pw
@ajaykumar-xy6pw 4 жыл бұрын
@@FunDooTesters thanks for responding quickly, can you please provide suggestions how can I mask and unmask the dynamically generated json data.
@FunDooTesters
@FunDooTesters 4 жыл бұрын
You can do with gson or regix pattern
@mariemzarai3969
@mariemzarai3969 2 жыл бұрын
Great explanation, thank you. but i have a problem. I need to read dynamically a swagger definition (complex json file) Then I will assign values retrieved from the JSONfile to ATTRIBUTES OF XML elements. I have to retrieve data and keep dependencies between objects. For example, I have to know all operationId and for each operation want to keep its information (responses, path, get or post..) and it referred to which tag. THE JSON FORMAT IS AS BELOW "paths": { "/api/v1/users": { "get": { "tags": [ "user-controller" ], "operationId": "getAllUsers", "responses": { "200": {} "post": { "tags": [ "user-controller" ], "operationId": "getAllUsers", "responses": { "200": {} "/api/v1/post": { "get": { "tags": [ "user-controller" ], "operationId": "getAllUsers", "responses": { "200": {} PLEASE WHAT CAN I DO ? thanks in advance
@FunDooTesters
@FunDooTesters 2 жыл бұрын
Hi Mariem, I understood problem statement. You will get solutions from google “extract data from swagger json”. Basically you need to understand mapping of data. You will find inbuilt methods to extract data. This is bit different thn json parsing We are also planning to cover such topics but it takes time. You can write me again if you have any doubts. Thanks, Nishant
@dineshkarthik5732
@dineshkarthik5732 4 жыл бұрын
Good video
@ADITYACOOL90
@ADITYACOOL90 4 жыл бұрын
Hi Nishant, Is this the only way to parse a JSON and do assertion? I see some videos where they have done using JsonPath, which is easier as well. When should we go with JSONObject and JSONArray approach in real-time projects?
@FunDooTesters
@FunDooTesters 4 жыл бұрын
Hi Aditya, In that case we need to write jsonpath for different response as well as different key and it won't work for dynamic and nested json. Even you can watch this as well kzfaq.info/get/bejne/rtyXapeWvbiaZn0.html Need to figure out based on scenarios
@ADITYACOOL90
@ADITYACOOL90 4 жыл бұрын
@@FunDooTesters Thanks Nishant.Can you please upload the code on github.
@praveenkk21
@praveenkk21 2 жыл бұрын
During the post method, I'm getting json value could not be converted to System.String... cam you please confirm what is the issue here! Tried all the method not worked..
@FunDooTesters
@FunDooTesters 2 жыл бұрын
Hi Praveen, could you please share code on fundootesters@gmail.com. I’ll take a look and before that you can go through github.com/Fundootesters/RestAssuredFramework and make sure you have written same logic and used same libs
@komalsudhirshinde7601
@komalsudhirshinde7601 3 жыл бұрын
Which dependency u have used for jsonobject at 3:29 I am using json simple vala but it is throwing me error
@FunDooTesters
@FunDooTesters 3 жыл бұрын
Hi Komal, Here is a pom.XML github.com/Fundootesters/RestAssuredFramework/blob/master/pom.xml I hope it will help you
@yoshitamahajan353
@yoshitamahajan353 Жыл бұрын
Also can you please make video on how to parse json to java bean for dynamic json
@FunDooTesters
@FunDooTesters Жыл бұрын
Sure
@manojlonar4912
@manojlonar4912 4 жыл бұрын
Hi Nishant, Thanks for the wonderful tutorial... How can I pass "Response response" as arguement instead of JSON in the method?
@FunDooTesters
@FunDooTesters 4 жыл бұрын
Could you please elaborate. I did not get it.
@zafferali4415
@zafferali4415 4 жыл бұрын
@@FunDooTesters I have the same question. I will elaborate. In rest assured, if send a request, we capture the response using Response class with some object. Example: Response response = request.request(Method.GET, "/");
@ramyaaddepalli6832
@ramyaaddepalli6832 3 жыл бұрын
@@zafferali4415 Hi,you need to convert response object to string and then pass this string object to JSONObject
@johnlin9880
@johnlin9880 3 ай бұрын
Hi FunDooTesters, Thank you for sharing your valuable knowledge. I have been trying to use the POJO class inorder to generate json body to the Request Payload. But this looks tedious on multi level nested jsons, is there a way or library available, which can consider the json template and populate the data from either a csv file or xls . I tried to check online but couldnt get much info. Ex: consider below as the template, with $variables could directly be replaced { "names":["firstname": "$fname", "lastname":"$lname"], "personal":["Occup":{ "occ1":"$occvalue","occ2":"$occvalue2" }] } csv file has fname,lname,occvalue,occvalue2 etc FunDo,Tester,value2,value3 James,Jim,value4,value5
@FunDooTesters
@FunDooTesters 3 ай бұрын
What do you have as an input, JSON schema?
@ishansharma3741
@ishansharma3741 Жыл бұрын
How to get Unique values , like i need id at 2nd place only as String not all values of key id
@FunDooTesters
@FunDooTesters Жыл бұрын
Jsonpath will solve your problem easily
@soumyaranjansahoo2667
@soumyaranjansahoo2667 2 жыл бұрын
Instead of printing I want to Store that value in a object and return it. In another class I will call getKey() method and Store that value. How to do that? You have taken void as return type. I can not get the value in another class.
@FunDooTesters
@FunDooTesters 2 жыл бұрын
You can create a static list and get all the data. Note: this method has more complexity in terms of framework coz of recurs ion
@kanishkatyagi4708
@kanishkatyagi4708 3 жыл бұрын
Hi Sir, Thanks for the video. Its really helpful. I have one scenario where I have multiple keys with same name within same json object and I want don't want to get all the values but only those value which is having specific parent. Can you please help me with this?
@FunDooTesters
@FunDooTesters 3 жыл бұрын
Nice question! You mean to say inside JSON array you have multiple JSON objects with same data or how ; multiple duplicate keys are not possible. It would be great if you can share sample JSON fundootesters@gmail.com
@brahmananda8962
@brahmananda8962 3 жыл бұрын
@@FunDooTesters Json file looks like this : { "matchingProfileName" : "CDQA-1", "ProfileType": "CD-Type-1" } { "matchingProfileName" : "CDQA-2", "ProfileType": "CFD-Type-2" } { "matchingProfileName" : "CFDQA-3", "ProfileType": "CFD-Type-23 } I need to validate all 'matchingProfileName's.How can I validate all matching profiel names
@manasagakkala6556
@manasagakkala6556 3 жыл бұрын
Were you able to resolve this scenario?
@manalijedhe7729
@manalijedhe7729 3 жыл бұрын
How to remove specific elements from simple.jsonObject? Remove not working
@FunDooTesters
@FunDooTesters 3 жыл бұрын
Json.remove()
@natrajp4926
@natrajp4926 4 жыл бұрын
Hi Nishant, Thanks for the video tutorial.it really helps.I have scenarios like having same key in json object and Json array ..how to get value in json array (Ex: {"name":"john","cars":[{"name":"ford"}]}).please help
@FunDooTesters
@FunDooTesters 4 жыл бұрын
Please let me know, Which scenarios you are going to perform?
@natrajp4926
@natrajp4926 4 жыл бұрын
@@FunDooTesters I am having json like this {"name":"john","cars":[{"name":"ford"}]} ..i need to get the value of key : name
@FunDooTesters
@FunDooTesters 4 жыл бұрын
This code should work for same
@subhrasarkar517
@subhrasarkar517 3 жыл бұрын
Hello, how are you converting a json input into string value in eclipse?
@FunDooTesters
@FunDooTesters 3 жыл бұрын
It will automatically considered as string if you declare as string.
@mattrex002
@mattrex002 2 жыл бұрын
what is the dependency you are using in your POM ?
@FunDooTesters
@FunDooTesters 2 жыл бұрын
Take a look github.com/Fundootesters/RestAssuredFramework/blob/master/pom.xml
@vinamungekar
@vinamungekar 2 жыл бұрын
How do i compare the JSON objects in my array where the expected objects are not changing but the actual oder of response of objects is changing.
@FunDooTesters
@FunDooTesters 2 жыл бұрын
Not able to understand your problem statement completely. Try sorting and comparator. It should work
@vinamungekar
@vinamungekar 2 жыл бұрын
@@FunDooTesters { "arrayKey" : ["firstElement", "secondElement", "thirdElement"] } as { "arrayKey" : ["secondElement", "firstElement1", "thirdElement"] } i want to match the expected and actual API response but in the Actual reponse the array is dynamic every time i fetch the response.
@NishantGohel
@NishantGohel 2 жыл бұрын
@@vinamungekar Key should be static. Get the array object, Sort it, Compare using comparator or something similar. Like - Comparing Object References - Comparing Array Lengths - Arrays.equals method - Arrays.deepEquals method
@vinamungekar
@vinamungekar 2 жыл бұрын
@@NishantGohel is your mail id available...i can explain it to you better
@yoshitamahajan353
@yoshitamahajan353 Жыл бұрын
How to exit from this program when we have got the required value for the key?
@FunDooTesters
@FunDooTesters Жыл бұрын
It will automatically exit. No need to worry
@MrMadhur18
@MrMadhur18 4 жыл бұрын
Awesome video, can we pass direct json file not json as string ?
@FunDooTesters
@FunDooTesters 4 жыл бұрын
Thanks madhur. We can pass
@kanikajain2785
@kanikajain2785 3 жыл бұрын
I want to return a list of values returned from this method to be used in another method but because of recursive call it sets the list to null. Please suggest some way to resolve my problem. I will be very thankful to you
@amir208501
@amir208501 Жыл бұрын
Did you get a solution for this problem? If you did please share. How to get getKey() method to return list. Thank you,
@anilpal4338
@anilpal4338 3 жыл бұрын
Which Json library are you using is it open-source??
@FunDooTesters
@FunDooTesters 3 жыл бұрын
Yes it is free org.Json please have a look below github.com/Fundootesters/RestAssuredFramework/blob/master/pom.xml
@NeverStopLearning56
@NeverStopLearning56 7 ай бұрын
Can you please share the json data and code details in the description
@FunDooTesters
@FunDooTesters 5 ай бұрын
github.com/Fundootesters/RestAssuredFramework/blob/master/src/main/java/utils/ParseDynamicJson.java
@tejaswinigm2606
@tejaswinigm2606 Жыл бұрын
I have a list which I got from DB query based on few conditions, which contains below location details... I want o/p as segregated locations i.e all cities and zipcodes into its state, all states into country Cou1 state1 city1 zip1 Cou1 state2 city2 zip2 Cou1 state1 city 3 zip3 O/p sld be as Cou1 State1 Cit1 - zip1 Cit3 - zip3 State2 Cit2 - zip2
@padmasreefidogroups2364
@padmasreefidogroups2364 Жыл бұрын
in code i got error like json cannot be resolved what should i do?
@FunDooTesters
@FunDooTesters Жыл бұрын
Can you please share more details?
@yashbansal2526
@yashbansal2526 4 жыл бұрын
Hi can anyone let me know , while passing the json as string in java code, do you have to manually put all the backwards slashes before " or is there any way to do it automatically. Thanks!
@FunDooTesters
@FunDooTesters 4 жыл бұрын
It will automatically come when you paste json as a string in your IDE.
@yashbansal2526
@yashbansal2526 4 жыл бұрын
@@FunDooTesters thanks! You are doing a great job, keep it up👏
@Gaurav.Tripathi1
@Gaurav.Tripathi1 2 жыл бұрын
what is it's advantage over jsonpath ?
@FunDooTesters
@FunDooTesters 2 жыл бұрын
Common parsing utility need to develop once and can be used everywhere Json path every time need to write whenever have to extract data. Both works well. Can be chosen based on requirements
Parse JSON using Java
22:27
Coding Simplified
Рет қаралды 6 М.
English or Spanish 🤣
00:16
GL Show
Рет қаралды 7 МЛН
Dad Makes Daughter Clean Up Spilled Chips #shorts
00:16
Fabiosa Stories
Рет қаралды 2,8 МЛН
Nurse's Mission: Bringing Joy to Young Lives #shorts
00:17
Fabiosa Stories
Рет қаралды 4,1 МЛН
What is an API and how do you design it? 🗒️✅
15:26
Gaurav Sen
Рет қаралды 726 М.
Parsing Json in Java Tutorial - Part 1: Jackson and Simple Objects
15:32
CoderFromScratch
Рет қаралды 120 М.
37. Create Complex JSON Payload Using Java For Rest Assured
29:01
Retarget Common
Рет қаралды 13 М.
Automate your job with Python
6:07
John Watson Rooney
Рет қаралды 398 М.
How to read JSON file in Java? ( Jackson Databind )
12:44
Tech Recipes - Dipesh Hadye
Рет қаралды 18 М.
How to Send HTTP Request and Parse JSON Data Using Java
27:22
Coding Master - Programming Tutorials
Рет қаралды 201 М.
Learn JSON in 10 Minutes
12:00
Web Dev Simplified
Рет қаралды 3,2 МЛН
Tips and Tricks for Debugging JavaScript
13:03
James Q Quick
Рет қаралды 409 М.