下载依赖库jar包
Jackson的jar all下载地址:http://jackson.codehaus.org/1.7.6/jackson-all-1.7.6.jar
ObjectMapper mapper = new ObjectMapper();
String result = mapper.writeValueAsString(sc);
注意:
1.JackSon根据getter来定位Json对象的属性,而不是字段!
下载依赖库jar包
Jackson的jar all下载地址:http://jackson.codehaus.org/1.7.6/jackson-all-1.7.6.jar
ObjectMapper mapper = new ObjectMapper();
String result = mapper.writeValueAsString(sc);
注意:
1.JackSon根据getter来定位Json对象的属性,而不是字段!