List of usage examples for com.fasterxml.jackson.databind ObjectMapper toString
public String toString()
From source file:com.intel.genomicsdb.GenomicsDBPartitionInfo.java
/** * Create a JSON string from the partition info object * * @return A JSON string of the partition info * @throws IOException write throws IOException *///from ww w . j av a 2s . c o m public String toJSON() throws IOException { ObjectMapper mapper = new ObjectMapper(); mapper.writeValueAsString(toString()); return mapper.toString(); }
From source file:net.proest.librepilot.web.handler.ObjectHandler.java
public void handlePost(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { PrintWriter out = response.getWriter(); BufferedReader br = request.getReader(); String json = ""; while (br.ready()) { json += br.readLine();//from w w w . ja v a 2 s .c o m } System.out.println(json); json = json.replaceFirst("json=", ""); System.out.println(json); json = URLDecoder.decode(json, "utf-8"); System.out.println(json); System.out.println(); ObjectMapper mapper = new ObjectMapper(); JsonNode actualObj = mapper.readTree(json); out.println(actualObj.asText()); out.println(mapper.toString()); }