When I try to send cross-domain jsonp request with:
$.getJSON(url + "?callback=?",
value : 'John',
record : {
value : 'a',
list : [ 1, 2 ]
});
Then i try to get it with java servlet like this:
public class TestServlet extends HttpServlet {
protected void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
String output = request.getParameter("callback")
+ "({\"response\":\"test\"});";
response.setContentType("application/javascript;charset=utf-8");
PrintWriter out = response.getWriter();
out.println(output);
}
}
Inside servlet request string has parameter names:
_=1353482336546
value=John
record[value]=a
How can i parse request string to original JSON?
Im using embedded jetty server and I want to use "JSON to Object" jetty parser on JSON string