Annotating be used Json serialized by Jackson

Jackson used by default when spring boot json formatted package, several of its common notes:

@JsonIgnore used in the above properties, the serialization and deserialization automatically ignore this property

@JsonProperty ( "xxx") used in the above properties, the properties are identified during serialization and deserialization of xxx

@JsonPropertyOrder (Value = { "pname1", "pname2"}) used in the above entity class, attribute mainly to change the order when deserialized, pname1 and two property names are pname2 entity class

@JsonInclude (JsonInclude.Include.NON_NULL) used in the above property, when the attribute value is empty, when it is deserialized ignore this property

@JsonFormat (pattern = "yyyy-MM-dd HH: mm: ss", timezone = "GTM + 8") type used in time (date) of the above properties, the following time format during serialization and deserialization : 2019-09-09 12:02:01

Set global Jackson spring boot sequence in time of the date format in application.yml (here only for the suffix is ​​yml profile, other wording may be different):

server: // set the start port here when 
port: 8888

spring: // When this date format global settings
Jackson:
DATE-the format: the MM-dd-YYYY HH: mm: SS
Time-Zone: GTM +. 8

Guess you like

Origin www.cnblogs.com/maycpou/p/11619130.html