Java servlet not returning JSON Object to jquery ajax

i am building web using JSP with servlet. I code JSP to get data from Servlet using jquery ajax, which is returning JSON type. but when i tried to convert servlet response data into JSON and try to logging with console.log on ajax success, it’s not returning JSON Object.

i’m using org.json.simple.JSONObject library for converting.

Here is my jquery code :

$.ajax({
    url : BASEPATH + 'load',
    type : 'get',
    success : function(response) {
        console.log(response);
    },
    error : function(response) {
        alert('error');
    }
});

Here is my servlet code :

import org.json.simple.JSONObject;

public class SourceSystemServlet extends HttpServlet
{
    JSONObject resp = new JSONObject();

    public SourceSystemServlet()
    {
        super();
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    {
        int code = 0;
        String message = "";

        code = 200;
        message = "Success";

        resp.put("code", code);
        resp.put("message", message);
        response.setContentType("application/json");
        response.getWriter().write(resp.toString());
    }

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
    {
        doPost(req, resp);
    }
}

i want to get data JSON object like this :

but what i’ve got is data string like this, so i can’t use response as object to logging i.e console.log(response.code) :

i hope someone can help me, thanks.

I think you may try resp.toJSONString() not resp.toString().