I want to ignore some fields when using JSONArray:
public class Person {
private Integer id;
private String name;
//field to ignore in json
private Account account;
...
Here I use JSONArray:
public static JSONArray listToJson(List objects) throws JSONException {
return new JSONArray(objects);
}