首页 > 编程知识 正文

fastjson和jackson,jackson注解详解

时间:2023-05-04 12:07:09 阅读:15625 作者:3787

given a simple entity class like this

公共类用户

{

@JsonProperty

公共日历创建on;

@JsonProperty

公共字符串名称;

}

isthereawayformetohookintothejacksonstreamingapitocustomdeserializeonlythecreatedonfield? If there's not,thenwouldsomethinglikethisbepossibleinthefuture?

公共类用户

{

@JsonProperty

@ JSON转换器(mycustomcalendarconverter.class )。

公共日历创建on;

@JsonProperty

公共字符串名称;

}

itappearsthaticouldcustomdeserializetheentireentity.I ' mjustcuriousifthereisawaytocustomizethedeserializationjustafieldatatation ializationa e in order to,for example,customparseaparticulardateformat,orreadanarrayofvaluesintoacustomentity,etc.whileleleler

解决方案

youcandefinecustomserializeaspecificfieldusing @ JSON serialize :

@ JSON串行化(using=mucustomcalendarconverter.class ) )。

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。