将java中的list转成json字符串 jackson

如有不懂的话,请看上一篇:
http://xshow.iteye.com/blog/751987
1.转换
StringWriter sw = new StringWriter();
JsonGenerator gen = new JsonFactory().createJsonGenerator(sw);
JacksonUtil.getInstance().writeValue(gen, jsonlist);
gen.close();
String finalInfo = sw.toString();
System.out.println("finalinfo is:"+finalInfo );


你可能感兴趣的:(java,json,Blog)