Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the Jackson parsing tool

2025-04-12 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

How to use Jackson parsing tools, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, I hope you can gain something.

Notes on Json parsing tool Jackson

@ JsonIgnoreProperties

This annotation is a class annotation that ignores some attributes in Java bean when json serialization, and both serialization and deserialization are affected.

@ JsonIgnore

This annotation is used on properties or methods (preferably on properties) and works the same as @ JsonIgnoreProperties above.

@ JsonFormat

This annotation is used on properties or methods (preferably on properties), and it is convenient to convert Date types directly into the schema we want, such as @ JsonFormat (pattern = "yyyy-MM-dd HH-mm-ss").

@ JsonProperty

This annotation is used on an attribute to serialize the name of the attribute to another name, such as serializing the trueName attribute to name,@JsonProperty ("name").

@ JsonSerialize

This annotation is used on properties or getter methods to embed our custom code when serializing, such as limiting two decimal places after a double serialization.

@ JsonDeserialize

This annotation is used on properties or setter methods to embed our custom code when deserializing, similar to @ JsonSerialize above

@ JsonInclude (Include.NON_NULL) / / put the tag on the attribute, if the attribute is NULL, do not participate in serialization / / if placed on top of the class, it has an effect on all properties of the class

Other options

/ / Include.ALWAYS default / / Include.NON_DEFAULT attribute is the default value does not serialize / / Include.NON_EMPTY attribute is empty ("") or NULL does not serialize / / Include.NON_NULL attribute is NULL does not serialize does it help you to read the above? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report