Question: Write a Java program that reads a JSON file containing a list of students. Each student has a name, age, and major. The program should:
Write a Java program that reads a JSON file containing a list of students. Each student has a name, age, and major. The program should:
Deserialize the JSON data into a list of Student objects. Print each student's details to the console. Modify the list by adding a new student and then serialize the updated list back to a new JSON file.
JSON file:
"student":
id:
"name": "Alice",
"age":
"major": "Computer Science"
"student":
id:
"name": "Bob",
"age":
"major": "Mathematics"
"student":
id:
"name": "Charlie",
"age":
"major": "Physics"
"student":
id:
"name": "David",
"age":
"major": "Biology"
"student":
id:
"name": "Eve",
"age":
"major": "Chemistry"
"student":
id:
"name": "Frank",
"age":
"major": "Electrical Engineering"
"student":
id:
"name": "Grace",
"age":
"major": "Mechanical Engineering"
"student":
id:
"name": "Hannah",
"age":
"major": "Environmental Science"
"student":
id:
"name": "Ian",
"age":
"major": "Business Administration"
"student":
id:
"name": "Judy",
"age":
"major": "Information Technology"
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
