Programming Tips - How can my servlet return JSON?

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