Here you can find the source of writeValueAsString(Object obj)
public static String writeValueAsString(Object obj)
//package com.java2s; //License from project: Apache License import com.fasterxml.jackson.databind.ObjectMapper; public class Main { static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); public static String writeValueAsString(Object obj) { try {//from ww w . ja v a 2 s . co m return OBJECT_MAPPER.writeValueAsString(obj); } catch (Exception e) { System.err.println(e.getMessage()); return null; } } }