I'm trying to convert an object, and this object has an ArrayList object has attribute and an integer.
But when i use to toString() on the JSON object I got pointers instead of the object:
{"class":"class model.ListResult","listVideo":["model.Video@706a4d1a","model.Video@52ec1f9e","model.Video@c0fe89a","model.Video@686fdca5","model.Video@7ff0a34","model.Video@78f6e005","model.Video@17eda64e","model.Video@73415727","model.Video@46c0fc8e"],"numberOfResult":109}
Here is the code for my class:
public class ListResult implements Serializable {
    private int numberOfResult;
    private ArrayList<Video> listVideo;
    /**
     * Constructor
     * 
     * @param allVideoNumber
     * @param listVideo2
     */
    public ListResult(int numberOfResult, ArrayList<Video> listVideo) {
        this.numberOfResult = numberOfResult;
        this.listVideo = listVideo;
    }
    public int getNumberOfResult() {
        return numberOfResult;
    }
    public void setNumberOfResult(int numberOfResult) {
        this.numberOfResult = numberOfResult;
    }
    public ArrayList<Video> getListVideo() {
        return listVideo;
    }
    public void setListVideo(ArrayList<Video> listVideo) {
        this.listVideo = listVideo;
    }
}
And my method call :
public String getListJson(boolean escape, int from, int number, String order, String by, ArrayList<Category> listCategory) throws Exception {
    //get list of video
    ArrayList<Video> listVideo = dbVideo.getAll(from, number, order, by, listCategory);
    JSONObject jsObject = new JSONObject(new ListResult(dbVideo.getAllVideoNumber(listCategory), listVideo));
    if(escape) {
        String  r;
        r = jsObject.toString();
        r = r.replace("\\", "\\\\");
        r = r.replace("'", "\\'");
        return r;
    }
    return jsObject.toString();
}
 
     
    