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

แชร์
ฝัง
  • เผยแพร่เมื่อ 28 ธ.ค. 2024

ความคิดเห็น • 257

  • @naveenbv1838
    @naveenbv1838 4 ปีที่แล้ว +17

    Hatsoff man 👍Really cool stuff which I was looking for .
    Thanks a lot for your effort🙏

  • @mfs1316
    @mfs1316 3 ปีที่แล้ว +1

    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  3 ปีที่แล้ว

      Glad to hear that. Stay tuned with us for amazing content

  • @ensarbati5271
    @ensarbati5271 2 ปีที่แล้ว +3

    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 ปีที่แล้ว +1

      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 ปีที่แล้ว +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 🙏

  • @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

  • @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.

  • @samirangelgmit
    @samirangelgmit 4 ปีที่แล้ว +2

    Great, really appriciated for all your efforts...One of the best trainer🤘 keep posting more n more

  • @sridharraju3249
    @sridharraju3249 3 ปีที่แล้ว +2

    Great work Nishant! Expecting more Java videos like this scenario from you! thanks :)

    • @FunDooTesters
      @FunDooTesters  3 ปีที่แล้ว +2

      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

  • @jayantagarwal6339
    @jayantagarwal6339 3 ปีที่แล้ว +1

    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!

  • @suhailakhtar1707
    @suhailakhtar1707 2 ปีที่แล้ว

    this video is very helpful. thanks bhaiya!!!!

  • @testqaa1626
    @testqaa1626 4 ปีที่แล้ว +2

    Really good. I was looking for this. Thank you sir

  • @markthomas9641
    @markthomas9641 2 ปีที่แล้ว +1

    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

  • @shubhamsharma-mt4hs
    @shubhamsharma-mt4hs 3 ปีที่แล้ว +1

    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

  • @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

  • @vaishalichavhan4536
    @vaishalichavhan4536 2 ปีที่แล้ว +1

    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)'

  • @ggmushorts
    @ggmushorts 3 ปีที่แล้ว +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  3 ปีที่แล้ว +1

      Glad you liked it. Sure Suryakant I’ll try to cover these topics after ongoing series

  • @monalishapradhan1495
    @monalishapradhan1495 2 ปีที่แล้ว

    Great stuff!!!! Thanks for sharing 😀

  • @julissamendezangeles
    @julissamendezangeles 3 ปีที่แล้ว

    Thanks a lot for Sharing , great examples and code

  • @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

  • @delarcro
    @delarcro 3 ปีที่แล้ว +1

    Really great implementation

  • @haribabuvelakavaram5935
    @haribabuvelakavaram5935 4 ปีที่แล้ว +1

    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.

  • @rameshgaming1020
    @rameshgaming1020 4 ปีที่แล้ว

    Excellent stuff man!!! hats off!!! you just made life simple...

  • @abhisheks2505
    @abhisheks2505 2 ปีที่แล้ว

    Thanks for sharing your knowledge. Much appreciated :)

  • @flight_of_phoenix
    @flight_of_phoenix 3 ปีที่แล้ว +1

    Awesome stuff

  • @sakshiaggarwal6199
    @sakshiaggarwal6199 3 ปีที่แล้ว

    Thank you so much for sharing the informative content!!

  • @tanunesta
    @tanunesta 3 ปีที่แล้ว

    Thank you so much for sharing your knowledge with us!
    God bless you!

    • @FunDooTesters
      @FunDooTesters  3 ปีที่แล้ว

      Glad you liked it. You are so kind

  • @amir208501
    @amir208501 2 ปีที่แล้ว

    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.

  • @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....

  • @qibbs8934
    @qibbs8934 ปีที่แล้ว

    Is it possible to exclude the method from parsing certain arrays?

  • @ArunRajput-ut7gt
    @ArunRajput-ut7gt 4 ปีที่แล้ว +1

    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 ปีที่แล้ว +1

      Please add correct dependency mvnrepository.com/artifact/org.json/json/20200518

  • @ravipathak2217
    @ravipathak2217 6 หลายเดือนก่อน

    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

  • @sanutsk
    @sanutsk 4 หลายเดือนก่อน

    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.

  • @thinkjava4807
    @thinkjava4807 2 ปีที่แล้ว

    How to return getkey method in the same class or another class?. I want to store the json values to compare with expected values . I tried with object return but couldn’t..

    • @FunDooTesters
      @FunDooTesters  2 ปีที่แล้ว +1

      Store data in pojo share use shared object, that should solve purpose

    • @Subomb95
      @Subomb95 2 ปีที่แล้ว

      Please help us to know how we can achieve it

  • @yelloverz5537
    @yelloverz5537 4 ปีที่แล้ว +1

    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 ปีที่แล้ว +1

      Hi Gijo,
      Not able to understand, Could you please elaborate . Apology for late reply.

  • @SoltLikeThis
    @SoltLikeThis 3 ปีที่แล้ว

    Thanks a lot, man! Great job, it helps me a lot.

  • @rajesho9772
    @rajesho9772 3 ปีที่แล้ว

    Good one bro

  • @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

  • @testsaucelabs6997
    @testsaucelabs6997 4 ปีที่แล้ว

    I was looking this. Thank you sir

  • @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

  • @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.

  • @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!

  • @johnlin9880
    @johnlin9880 7 หลายเดือนก่อน

    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  7 หลายเดือนก่อน

      What do you have as an input, JSON schema?

  • @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..

  • @Lakshmisridhar
    @Lakshmisridhar 4 ปีที่แล้ว +3

    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 ปีที่แล้ว +3

      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 ปีที่แล้ว +1

      Waiting for the same bro..

    • @shashwatkatiyar1377
      @shashwatkatiyar1377 4 ปีที่แล้ว

      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?

  • @ajaykumar-xy6pw
    @ajaykumar-xy6pw 4 ปีที่แล้ว +1

    Can we use blob and clob objects in the json response as well, will it work with that as well?

    • @FunDooTesters
      @FunDooTesters  4 ปีที่แล้ว +1

      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 ปีที่แล้ว +2

      @@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

  • @sandeepb6253
    @sandeepb6253 4 ปีที่แล้ว +1

    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 ปีที่แล้ว +2

      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

  • @anupkapale7953
    @anupkapale7953 4 ปีที่แล้ว +2

    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 ปีที่แล้ว +1

      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?

  • @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.

  • @nareshkeeplearing655
    @nareshkeeplearing655 4 ปีที่แล้ว +1

    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 ปีที่แล้ว +1

      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

  • @praveenkk21
    @praveenkk21 3 ปีที่แล้ว

    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  3 ปีที่แล้ว

      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

  • @ishansharma3741
    @ishansharma3741 2 ปีที่แล้ว

    How to get Unique values , like i need id at 2nd place only as String not all values of key id

    • @FunDooTesters
      @FunDooTesters  2 ปีที่แล้ว

      Jsonpath will solve your problem easily

  • @yogeshnipate
    @yogeshnipate 2 ปีที่แล้ว

    Hey Thank you for your wonderful explanation , Could you please share dependency you have used with version ?

    • @FunDooTesters
      @FunDooTesters  2 ปีที่แล้ว +1

      Hey Yogesh, glad you liked it.
      github.com/Fundootesters/RestAssuredFramework

  • @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

  • @nguyenquan4836
    @nguyenquan4836 2 ปีที่แล้ว

    Thank you so much!

  • @me.nilesh
    @me.nilesh 4 ปีที่แล้ว

    Thanks mate! Very helpful

  • @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?

  • @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

  • @jayantagarwal6339
    @jayantagarwal6339 3 ปีที่แล้ว

    thanks, sir @Fun Doo Testers

  • @viratsuresh5946
    @viratsuresh5946 2 ปีที่แล้ว

    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  2 ปีที่แล้ว

      Key= employee object I’d
      Value= employe object.
      If you can share complete data I can help

  • @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

  • @payaljindal1621
    @payaljindal1621 10 หลายเดือนก่อน

    Hi Fundoo will u pls help with my JSON as it is little different from yours and parsing root is also different

    • @FunDooTesters
      @FunDooTesters  9 หลายเดือนก่อน

      Please share take a look github.com/Fundootesters/RestAssuredFramework/blob/master/src/main/java/utils/ParseDynamicJson.java once

  • @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

  • @bapusoumya1
    @bapusoumya1 4 ปีที่แล้ว

    Really Good!! Keep it up :)

  • @rakeshs277
    @rakeshs277 3 ปีที่แล้ว

    Really help method.

  • @shameem132
    @shameem132 4 ปีที่แล้ว +1

    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.

  • @RahulSaini-ji1pn
    @RahulSaini-ji1pn 2 ปีที่แล้ว

    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

  • @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 ปีที่แล้ว +1

      Sure will add soon stay tuned

  • @saurabhsanyal4218
    @saurabhsanyal4218 2 ปีที่แล้ว +1

    It's 4 in the morning just want to thank you, can I buy you a cup of coffee?

    • @FunDooTesters
      @FunDooTesters  2 ปีที่แล้ว

      You are too kind. Glad you liked it

  • @pragyanmishra-fl2vx
    @pragyanmishra-fl2vx 6 หลายเดือนก่อน

    please provide these nested json files you have used. it will help me while learning on my eclipse IDE.

  • @hdkloh
    @hdkloh 4 ปีที่แล้ว +1

    Why don't you use Hashmap instead? esp for the dynamic json objects

  • @adityakashyap6765
    @adityakashyap6765 ปีที่แล้ว

    Can you make a video on updating the value for dynamic json?

  • @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 2 ปีที่แล้ว

      Did you get a solution for this problem? If you did please share. How to get getKey() method to return list. Thank you,

  • @pankajmodi426
    @pankajmodi426 ปีที่แล้ว

    bro i am using this code but getting lots of error, JSONObject.has(); json.keys(); etc having error ,,,plz suggest proper library

  • @soumyaranjansahoo2667
    @soumyaranjansahoo2667 3 ปีที่แล้ว

    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  3 ปีที่แล้ว

      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

  • @yashpalwaghmare1701
    @yashpalwaghmare1701 3 ปีที่แล้ว +1

    This is one of the best video I have seen, excellent explanations. Could I get the git repo url for this.?

    • @FunDooTesters
      @FunDooTesters  3 ปีที่แล้ว +1

      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?

  • @keepsmile564
    @keepsmile564 4 ปีที่แล้ว

    Very good.

  • @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 ปีที่แล้ว +3

      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 th-cam.com/video/xvg74eXR66I/w-d-xo.html
      Need to figure out based on scenarios

    • @ADITYACOOL90
      @ADITYACOOL90 4 ปีที่แล้ว

      @@FunDooTesters Thanks Nishant.Can you please upload the code on github.

  • @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

  • @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

  • @jayeshjain6052
    @jayeshjain6052 3 ปีที่แล้ว

    can i put file in place of pasting the string in json

  • @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 ปีที่แล้ว +2

      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👏

  • @dineshkarthik5732
    @dineshkarthik5732 4 ปีที่แล้ว

    Good video

  • @kanishkatyagi4708
    @kanishkatyagi4708 4 ปีที่แล้ว

    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  4 ปีที่แล้ว

      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?

  • @padmasreefidogroups2364
    @padmasreefidogroups2364 2 ปีที่แล้ว

    in code i got error like json cannot be resolved what should i do?

    • @FunDooTesters
      @FunDooTesters  2 ปีที่แล้ว

      Can you please share more details?

  • @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.

  • @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

  • @yoshitamahajan353
    @yoshitamahajan353 ปีที่แล้ว

    Also can you please make video on how to parse json to java bean for dynamic json

  • @yelloverz5537
    @yelloverz5537 4 ปีที่แล้ว

    Sooper cool... But it is more better if you can adjust the subtitle... It will improves the readability..

  • @wish71227
    @wish71227 4 ปีที่แล้ว

    How can we get the values for all the keys instead of just one key?

    • @FunDooTesters
      @FunDooTesters  3 ปีที่แล้ว

      You can flatten the response and loop through. It will give you all values and keys.

    • @wish71227
      @wish71227 3 ปีที่แล้ว

      @@FunDooTesters can you suggest the method to do it?

  • @surwase1
    @surwase1 3 ปีที่แล้ว

    Great Tutorial!. Can you create video on how to update any field in JSON on the fly?

  • @manalijedhe7729
    @manalijedhe7729 4 ปีที่แล้ว +1

    How to remove specific elements from simple.jsonObject? Remove not working

  • @sushiltiwari274
    @sushiltiwari274 3 ปีที่แล้ว

    If it is related to specific object like If I want phone number of particular student then what will be the way

    • @FunDooTesters
      @FunDooTesters  3 ปีที่แล้ว

      You have to search student name first thn within that object or list go for phone number. Think like nested array

  • @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 ปีที่แล้ว +1

      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.

  • @sankalparora9374
    @sankalparora9374 3 ปีที่แล้ว

    I cannot use JSONObject class. What to do?

    • @FunDooTesters
      @FunDooTesters  3 ปีที่แล้ว +1

      Have you correctly imported?

    • @sankalparora9374
      @sankalparora9374 3 ปีที่แล้ว

      @@FunDooTesters seems I imported nothing. I'll check once again.

  • @2RAJ21
    @2RAJ21 3 หลายเดือนก่อน

    Thank you

  • @abhishekshukla633
    @abhishekshukla633 2 ปีที่แล้ว

    Hi , can i get some solution without recursion?

    • @FunDooTesters
      @FunDooTesters  2 ปีที่แล้ว

      Don’t think so it is possible for any json

  • @vikrantmukkawar9737
    @vikrantmukkawar9737 3 ปีที่แล้ว

    Nice Tutorial can you make video on java object to json using GSON for nested object and array with some complexity

  • @NeverStopLearning56
    @NeverStopLearning56 11 หลายเดือนก่อน

    Can you please share the json data and code details in the description

    • @FunDooTesters
      @FunDooTesters  9 หลายเดือนก่อน +1

      github.com/Fundootesters/RestAssuredFramework/blob/master/src/main/java/utils/ParseDynamicJson.java