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
Thak you for the complete tutorial about JSON, and kudos for the easy to understand examples shown !
Welcome
Awesome... I have learned complete automation by just your video... You are awesome
Glad to hear that
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
Welcome
tnq for the example coding and explanation it very use full to me. tns a lot sir.
Welcome
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.
Clear explanation about reading JSON object and JSON Array
Thanks
well explained in simple way.
thanks
Thank you a lot sir, this is exactly what I was looking for.
You are welcome!
Thank you sir for this type of video. which helps us to learn in practical way.
welcome
Clear cut explanation always❤
Thanks
Thank you for this amazing explanation.
You're very welcome!
Hello sir,
I never comment here, but you made me to do today
That was very clear explanation
is very nice! thanks for this video Sir
Welcome
Thank you! Excellent tutorial, getting back in the groove of Java syntax.
Thanks for this tutorial
Always welcome
Such a good video! Thank you so much! Saved my User Story
most welcome
Good explanation :)
Thanks
Thanks sir for posting
Welcome
Thank you for the wonderful video.
LIFE SAVER! Thank you sir!
Welcome
dude, you're the best. thank you so much
Excellent explanation sir.. I'm looking for this content 🙏
Thanks
Very good tutorial.
Glad you liked it!
Thanks a lot ! You save my day!
You're welcome!
I was looking for it.
Thanks for great video.
Glad you liked it
You solved my problem brother. Thank you :)
Welcome
Thank you so much 🎉
Excellent job! Thank you
Glad you liked it!
Thanks a lot Sir for amazingly Explaining each line .....
Most welcome
Explained clearly. thank you for the video❤
welcome
Crystal Clear Explanation SIr
Thank you for your feedback.
Thank you very much you are doing a great service.
How would I write to a JSON file using java?
Thanks a lot sir
Most welcome
Very useful.. Thanks a lot ! 👍🏻
Thanks you so much 😗💓
You're welcome
Thank you so much
You're most welcome
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.
can we use the instead of json parsor can we use objectmapper
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?
I'm getting Same error have you got the solution?
@@VrlHtzz me too, did you get the solution
@@andyrojhn9235 I actually don't remember now 😅 you can find your solution using chatGPT
@@VrlHtzz jokes on me xd
@@hiiamjohnwatchweontv5552 what 🙄
Hi sir, is there any chances of editing the existing data on json file???
very helpful, thanks
You're welcome!
Thanks 🙏
You’re welcome 😊
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.
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?
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.
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
Thank you, but what if we want to have array of employees, or having multiple employees?
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.
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.
Will you Please share how to write the same json file using loop
Wouldn't it be ok to apply serialization as well?
Can I write the json data in class?
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
Bot sure if this is still relevant, but do you mean something like, say: ‘ “test”:[obj_1,obj_2] ‘
Tell me how to change value of json object using java its urgent
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.
Hello sir can you show how to read data of json file from resources folder in spring boot?
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
}]
Hi
Do you have an the Json code
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");
use long instead of int
Can you put the data(from JSON file) in ArrayList or any other data structure ?
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.
thaks, how to update the values from json file and create a post request.
Can u tell me how to read json in c
I dont know if thats the old version ,but now you CANT not select an archetype
please post the josn you use in your example in description
You can check it now. I copied JSON in description.
I dont have Malven in eclipse
How can i do now??
While running the code I am getting exception in thread " main " unexpected character ( c) at position 189
Same error Any Fix?
When i create employee.jsom, its coming with icon as {}, but for you it came as circle, why so?
Install "JSON Editor plugin" from Eclipse Market place. You will get circle icon.
Can you please explain what parser means and why it is used
it is used to read the JSON file
@@subhanshutripathi1352 thanks
json simple is too old , it is better to user Gson or Jackson
its showing error not foundjsonparser
same here !
thank you very much
welcome