I am developing a java console application and using JSON to store data. This is my query. I want to add data inside the existing node without losing data.
I have this Node:
{
"course" :
[
],
}
Now I want to write new data inside course, for example:
{
"course" :
[
"coursel", {
"EndDate" : "16/09/2022",
"StartDate" : "16/09/2022"
},
"course2", {
"EndDate" : "1/10/2022",
"StartDate" : "1/10/2021"
}
],
}
Please avoid pasting code snippet as image in your question. Looks like the json structure you mentioned is invalid. Please refer below code.
Actual Json (Before running the program):
Source Code:
Json (After running the code):