The JSON file format I need to use looks like this
[{"fName":"Bob","lName":"Smoe","info":"is tall"},{"fName":"Claire","lName":"Smoegan","info":"has a big forehead"}]
I have an object list of people that I add to a JSON array. The code looks like this
for (int i = 0; i < peopleList.size(); i++){
try {
jArray.put(peopleList.get(i));
}catch (Exception e){
e.printStackTrace();
}
}
The problem is, I need to convert it to a string to write to a file, but when I use "jArray.toString()" it returns
"["com.example.zach.projectFile.Person@21b854e0", "com.example.zach.projectFile.Person@21b854e0", "com.example.zach.projectFile.Person@21b85400"....]
How do I get this to return it in the format requested above?
jArrayis.