public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("application/json"); PrintWriter out = response.getWriter(); out.println("{ \"result\": \"Hello\" }"); }
Programming Tips - Java: How can my Servlet return JSON?
Date: 2013may23
Platform: Servlet
Language: Java
Q. Java: How can my Servlet return JSON?
A. Like this: