JSON Tutorial Part-5 | How To Read Data from JSON File in Java | JSON Simple API

แชร์
ฝัง
  • เผยแพร่เมื่อ 9 ก.พ. 2025
  • Topics :
    ------------
    1) How To Read Data from JSON File in Java
    2) JSON Simple API
    JSON Used:
    --------------------
    {
    "firstName": "John",
    "lastName": "Kennedy",
    "address": [
    {
    "street": "abc",
    "city": "Hyderabad",
    "state": "TL"
    },
    {
    "street": "xyz",
    "city": "Chennai",
    "state": "TN"
    }
    ]
    }
    #########################
    Udemy Courses:
    #########################
    Manual Testing+Agile with Jira Tool
    ************************************
    ► shorturl.at/xNXZ4
    Selenium with Java+Cucumber
    ********************************
    ► shorturl.at/aIKMW
    Selenium with Python & PyTest
    ********************************
    ► shorturl.at/ELW09
    Selenium with python using Robot framework
    ****************************************
    ► shorturl.at/bcDPZ
    API Testing(Postman, RestAssured & SoapUI)
    *****************************************
    ► shorturl.at/uAWY7
    Web & API Automation using Cypress with Javascript
    ********************************************
    ► rb.gy/4uum2n
    Playwright with Javascript
    **************************
    ► shorturl.at/gALZ1
    Jmeter-Performance Testing
    ************************
    ► rb.gy/ocj7r2
    SDET Essencials(Full Stack QA)
    *************************
    ► rb.gy/hlnf2v
    Appium-Mobile Automation Testing
    ************************************
    ► rb.gy/wmzv64
    Java Collections
    *****************
    ► bit.ly/3S66ezE
    Python Programming
    *********************
    ► urlis.net/gdsf...
    Cucumber BDD Framework
    ***************************
    ► bit.ly/3F7d69r
    Protractor with Javascript
    ***************************
    ► urlis.net/4udd...
    ####################################
    TH-cam Playlists:
    ####################################
    Manual Testing & Agile
    ***********************
    ► bit.ly/3ujvaYa
    ► bit.ly/3OYzxQj
    SQL
    *************************
    ► bit.ly/3R6XjeG
    ► bit.ly/3nE0a1s
    ► bit.ly/3IeKuuJ
    linux & Shell Scripting
    **********************
    ► bit.ly/3up1Z6a
    ► bit.ly/3nzvGxx
    Java
    **********************
    ► bit.ly/3R9QfOs
    ► bit.ly/3AoRMKM
    ► bit.ly/3IbTTDn
    ► bit.ly/3ybXInv
    ► bit.ly/3yCoHdw
    Selenium With Java+Cucumber
    ********************************
    ► bit.ly/3P2FMm4
    ► bit.ly/3yhiIt4
    ► bit.ly/3uokzet
    ► bit.ly/3a7XIND
    ► bit.ly/3umN2S9
    ► bit.ly/3aar7GW
    ► bit.ly/3y9kD2S
    ► bit.ly/3uhLskn
    Python
    ********************************
    ► bit.ly/3agNgU0
    ► bit.ly/3NJNnoy
    ► bit.ly/2CTQ4mR
    ► bit.ly/3OIYWh1
    Selenium With Python,Pytest&Behave
    ***************************************
    ► bit.ly/3OHHoC9
    ► bit.ly/3IeNLdv
    ► bit.ly/2J4tPeT
    ► bit.ly/3ydSkAq
    Selenium With Python Using Robert Framework
    (Web&API Testing)
    *************************************************
    ► bit.ly/3nUvlpr
    ► bit.ly/3nUvE3z
    API Testing (Postman,SoapUi,&Rest Assured)
    **********************************************
    ► bit.ly/3OXacWY
    ► bit.ly/3yh0UhE
    ► bit.ly/3nC9DWQ
    ► bit.ly/3yGfhNS
    ► bit.ly/3OJa11H
    ► bit.ly/3P2slCC
    Mobile App Testing Appium
    ****************************
    ► bit.ly/3Al49HG
    Performance Testing Jmeter
    *******************************
    ► bit.ly/3nz4fE7
    Maven,Jenkins,Git,Github,CI/CD
    *******************************
    ► bit.ly/3P16HPj
    ► bit.ly/3yhlUVA
    ► bit.ly/3afYfwT
    ► bit.ly/3yGzweG
    ► bit.ly/3yF73Ws
    ► bit.ly/3NCOmH7
    SQL,DB Testing&ETL,Bigdata
    *******************************
    ► bit.ly/3NKOcNY
    ► bit.ly/3OVpDyI
    ► bit.ly/3NEvUy0
    ► bit.ly/3IryxlT
    ► bit.ly/3RkWBLh
    JavaScript Based Automation Tools
    ********************************
    ► bit.ly/3nUx51X
    ► bit.ly/3AqI6Q0
    ► bit.ly/3yeurbT
    ► bit.ly/3ujzpTK
    Selector Hub Tools
    ********************
    ►rb.gy/h3h424
    GraphQL
    ******************
    ► rb.gy/sj3gys
    Cypress API Testing
    ********************
    ► shorturl.at/fjKPX
    Cypress Web Testing
    **********************
    ► shorturl.at/agjlK
    Playwright with Javascipt
    **************************
    ► shorturl.at/adSTY
    #JSONParsingJava
    #JavaJSONReading
    #JSONFileHandling
    #JavaFileIO
    #JSONDataExtraction
    #JSONDataManipulation
    #JavaDataParsing
    #JSONParsingTutorial
    #JavaJSONExamples
    #JSONReadCode
    #JavaProgramming
    #JSONDataProcessing
    #JavaTipsAndTricks
    #JSONDataAccess
    #JavaFileHandlingTips
    #JSONDataExploration
    #JavaProgrammingTutorial
    #JSONReadingMethods
    #JavaJSONParsingDemo
    #JSONFileOperations
    #JavaIOExplained
    #JSONParsingTechniques
    #JavaFileReadTutorial
    #JSONDataFetching
    #JavaJSONReadingGuide
    #JSONParsingBestPractices
    #JavaFileManipulation
    #JSONDataVisualization
    #JavaCodingSkills
    #JSONParsingWalkthrough
    #JavaFileIOTricks
    #JSONDataAnalysis
    #JavaJSONHandsOn
    #JSONParsingStepByStep
    #JavaFileReadExamples
    #JSONDataTransformation

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

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

    Thak you for the complete tutorial about JSON, and kudos for the easy to understand examples shown !

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

    Awesome... I have learned complete automation by just your video... You are awesome

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

      Glad to hear that

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

    sir thankyou so much sir what a super content for JSON java there is no such content on youtube like your thankyou thankyou so much sir

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

    tnq for the example coding and explanation it very use full to me. tns a lot sir.

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

    Sir itne badhiya video hao bs audio thode increase kardete toh maja aa jata......may gbu you are very great. Thanks for the amaing conent.

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

    Clear explanation about reading JSON object and JSON Array

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

    well explained in simple way.

  • @Arnatore
    @Arnatore 4 ปีที่แล้ว +7

    Thank you a lot sir, this is exactly what I was looking for.

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

      You are welcome!

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

    Thank you sir for this type of video. which helps us to learn in practical way.

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

    Clear cut explanation always❤

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

    Thank you for this amazing explanation.

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

      You're very welcome!

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

    Hello sir,
    I never comment here, but you made me to do today
    That was very clear explanation

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

    is very nice! thanks for this video Sir

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

    Thank you! Excellent tutorial, getting back in the groove of Java syntax.

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

    Thanks for this tutorial

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

      Always welcome

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

    Such a good video! Thank you so much! Saved my User Story

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

      most welcome

  • @ArunS-lb8sc
    @ArunS-lb8sc 10 หลายเดือนก่อน +1

    Good explanation :)

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

      Thanks

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

    Thanks sir for posting

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

    Thank you for the wonderful video.

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

    LIFE SAVER! Thank you sir!

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

    dude, you're the best. thank you so much

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

    Excellent explanation sir.. I'm looking for this content 🙏

  • @JaswantSingh-di8nu
    @JaswantSingh-di8nu 3 ปีที่แล้ว +1

    Very good tutorial.

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

      Glad you liked it!

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

    Thanks a lot ! You save my day!

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

      You're welcome!

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

    I was looking for it.
    Thanks for great video.

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

      Glad you liked it

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

    You solved my problem brother. Thank you :)

  • @saswatibarman9478
    @saswatibarman9478 24 วันที่ผ่านมา

    Thank you so much 🎉

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

    Excellent job! Thank you

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

      Glad you liked it!

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

    Thanks a lot Sir for amazingly Explaining each line .....

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

      Most welcome

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

    Explained clearly. thank you for the video❤

  • @shaiksuleman3191
    @shaiksuleman3191 5 ปีที่แล้ว

    Crystal Clear Explanation SIr

    • @sdetpavan
      @sdetpavan  5 ปีที่แล้ว

      Thank you for your feedback.

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

    Thank you very much you are doing a great service.

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

    Thanks a lot sir

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

      Most welcome

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

    Very useful.. Thanks a lot ! 👍🏻

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

    Thanks you so much 😗💓

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

      You're welcome

  • @joseramirez-ep8pj
    @joseramirez-ep8pj 3 ปีที่แล้ว +1

    Thank you so much

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

      You're most welcome

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

    Do you have a video tutorial on integrating testrail with jenkins, by that i mean invoking a jenkins job to run automation test scripts and post back the results to testrail.

  • @SulochanaJaggini
    @SulochanaJaggini 5 หลายเดือนก่อน

    can we use the instead of json parsor can we use objectmapper

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

    Thanks, sir. But I am getting an Exception error for" (JSONObject)obj " saying that :
    "class org.json.simple.JSONObject cannot be cast to class org.json.JSONObject (org.json.simple.JSONObject and org.json.JSONObject are in unnamed module of loader 'app')".
    Please help, what should I do?

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

      I'm getting Same error have you got the solution?

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

      @@VrlHtzz me too, did you get the solution

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

      @@andyrojhn9235 I actually don't remember now 😅 you can find your solution using chatGPT

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

      @@VrlHtzz jokes on me xd

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

      @@hiiamjohnwatchweontv5552 what 🙄

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

    Hi sir, is there any chances of editing the existing data on json file???

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

    very helpful, thanks

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

      You're welcome!

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

    Thanks 🙏

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

      You’re welcome 😊

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

    Hello Sir,
    While trying to excute the code, I am getting org json.simple.JSONObject cannot be cast to org.json.simple.JSONArray.
    Kindly help me to resolve this.

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

    Is there a way we can filter the data we want to get? Can we use the dot and bracket notation as it is found in an array?

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

    Can you please explain what if at line 24, there is again JSON object. (inner JSON). I created a another object for inner JSON from outer one but that doesn't seem to work.

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

    im getting exception for converting Object into JSONObject -> Exception in thread "main" java.lang.ClassCastException: org.json.simple.JSONArray cannot be cast to org.json.simple.JSONObject
    ==== also checked ISONObject accepts map , so hows ur code working? if we are having Object with us? plz help me

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

    Thank you, but what if we want to have array of employees, or having multiple employees?

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

    Thanks, Sir for this video. Here we are values from the JSON one by one that we can do from the property file as well, is there any way so that we can parse the whole JSON file directly instead of reading single-2 values from the JSON, please make a video for the same.

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

    Great explanation.... Can you please advise if I need to filter the data in json then how can I do that. For ex. In my json I have key as severity and value as critical. Hence I need to filter out only the elements that contains this key value pair.

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

    Will you Please share how to write the same json file using loop

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

    Wouldn't it be ok to apply serialization as well?

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

    Can I write the json data in class?

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

    Sir, when we just have multiple records in a array without key value assigned to it like "address " then what should we write in place of array.get(what should we write here ) ? Please reply

    • @agon-eery
      @agon-eery ปีที่แล้ว

      Bot sure if this is still relevant, but do you mean something like, say: ‘ “test”:[obj_1,obj_2] ‘

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

    Tell me how to change value of json object using java its urgent

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

    Hi Sir , I am getting this error
    An internal error occurred during: "Search Marketplace for compatible editors (*.json)".
    I cannot resolve it. My json symbol is of Visual code and not Eclipse as shown in yours.

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

    Hello sir can you show how to read data of json file from resources folder in spring boot?

  • @SkAli-ol4hn
    @SkAli-ol4hn 2 ปีที่แล้ว

    Thank you Sir, my question is- how I get a specific value from JSONArray
    Inside of JSONArray there is a lots of element with same keys but different value example of I need Value Of "Y" from 4th number elements and we Don't know the elements number then ?
    "address": [
    {"x":xyz,
    "Y":abc},
    {"x":xyz,
    "Y":abc
    },
    {"x":xyz,
    "Y":nsmsm
    },
    {"x":xyz,
    "Y":sjksk
    }]

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

    Hi
    Do you have an the Json code

  • @sureshisoft4555
    @sureshisoft4555 5 ปีที่แล้ว

    hi pavan ..how to Typecast jsonobject ito onto integer...my json file has integer valuew getting error like "Cannot Cast object to int" -int empid=(int) empjsonobject.get("id");

    • @hyperion4899
      @hyperion4899 5 ปีที่แล้ว +1

      use long instead of int

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

    Can you put the data(from JSON file) in ArrayList or any other data structure ?

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

    I have one question please help me out
    [
    {
    "claim_id": "44",
    "claim_line": "1",
    "account_id": "444041"
    }
    ]
    I have this body that I have to use in POST request
    please tell me how to do that
    please help me out.

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

    thaks, how to update the values from json file and create a post request.

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

    Can u tell me how to read json in c

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

    I dont know if thats the old version ,but now you CANT not select an archetype

  • @nrravitej2498
    @nrravitej2498 5 ปีที่แล้ว

    please post the josn you use in your example in description

    • @sdetpavan
      @sdetpavan  5 ปีที่แล้ว

      You can check it now. I copied JSON in description.

  • @rahadulhaq6387
    @rahadulhaq6387 5 ปีที่แล้ว

    I dont have Malven in eclipse
    How can i do now??

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

    While running the code I am getting exception in thread " main " unexpected character ( c) at position 189

  • @nrravitej2498
    @nrravitej2498 5 ปีที่แล้ว

    When i create employee.jsom, its coming with icon as {}, but for you it came as circle, why so?

    • @sdetpavan
      @sdetpavan  5 ปีที่แล้ว

      Install "JSON Editor plugin" from Eclipse Market place. You will get circle icon.

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

    Can you please explain what parser means and why it is used

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

    json simple is too old , it is better to user Gson or Jackson

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

    its showing error not foundjsonparser

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

      same here !

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

    thank you very much