官方网址 http://wiki.fasterxml.com/JacksonInFiveMinutes
下载地址 http://wiki.fasterxml.com/JacksonDownload
我提供一个例子:
public class Test { private int a = 123; private String b = "懂"; public static void main(String[] args) throws IOException { ObjectMapper objectMapper = new ObjectMapper(); String str = objectMapper.writeValueAsString(new Test()); System.err.println("-------------" + str); } public int getA() { return a; } public String getB() { return b; } }
打印结果:
-------------{"a":123,"b":"懂"}