I have a movie
class
That has a private List<String> reviews = new ArrayList<String>();
On the constructor I set
public Movie()
{
this.reviews.add("");
}
When I try to add it to a JSON
object as so,
JSONObject.put("reviews", this.reviews.toArray(new String[reviews.size()]));
I checked the JSON
file and it return "reviews":[Ljava.lang.String;@5cad8086]
What is happening here? I want to put an Array of reviews into the field "reviews" like {"reviews" : ["somestring1", "somestring2"]}