json
小码哥cc
GitHub:https://github.com/chenpt123
博客园:https://www.cnblogs.com/chenpt/
展开
-
Jackson工具类(各种转换)
首先要在项目中引入jackson的jar包(在此不做说明) 下面直接上代码public class JacksonUtils { private final static ObjectMapper objectMapper = new ObjectMapper(); private JacksonUtils() { } public static ObjectMapper原创 2017-08-17 17:10:17 · 15228 阅读 · 0 评论 -
Jackson 处理复杂类型(List,map)
String jsonString="[{'id':'1'},{'id':'2'}]"; ObjectMapper mapper = new ObjectMapper(); JavaType javaType = mapper.getTypeFactory().constructParametricType(List.class, Bean.class); //如果是Map类型 map原创 2017-08-10 09:52:13 · 1744 阅读 · 0 评论 -
Json注解属性JsonIgnoreProperties,JsonInclude,JsonProperty总结小记
1.JsonIgnoreProperties属性 示例用法:@JsonIgnoreProperties(ignoreUnknown = true) 该注解是放在类名上面,作用是:忽略类中不存在的字段当接收的时候2.JsonInclude属性 示例用法:@JsonInclude(JsonInclude.Include.NON_NULL) 该注解也是放在类名上面,作用是:忽略类中字段值为null原创 2017-08-11 15:15:02 · 9613 阅读 · 0 评论