jacksons转换大小写处理

import com.fasterxml.jackson.databind.ObjectMapper;

1.注意导入的objectMapper包一致

另:jackson的注解大全
https://github.com/FasterXML/jackson-annotations/wiki/Jackson-Annotations
http://chenyiheng.iteye.com/blog/2098759


2.解决json转换过程中的自动小写问题 在字段上添加@JsonProperty() 在相应的getter和setter方法上添加@JsonIgnore

    {"identity":23,"msgid":1000,"sessionid":"","Data":{"Account":"admin","Password":"666666"}}
    如果getter和setter上面没有添加,结果会显示为Data和data都有

3.一个空的类(里面没有field和method时候):
我们想将他序列化 给该类添加注释@@JsonIgnoreProperties就可以了
在json中会表现为{xxxx:xxx,...,Date{}}
教训:类继承时候需要提取公共的部分!! 2016.3.10

posted @ 2016-03-09 14:53  FEI_>.<_JI  阅读(315)  评论(0编辑  收藏  举报