I have a List which I need to convert into JSON Object using GSON. My JSON Object has JSON Array in it.
public class DataResponse { private List
If response in your marshal method is a DataResponse, then that's what you should be serializing.
response
marshal
DataResponse
Gson gson = new Gson(); gson.toJson(response);
That will give you the JSON output you are looking for.