Package com.alibaba.fastjson2.annotation
Annotation Type JSONField
-
@Retention(RUNTIME) @Target({METHOD,FIELD,PARAMETER,ANNOTATION_TYPE}) public @interface JSONField
When the Key in the JSON does not match the property in theBean, the conversion process may not meet expectations.JSONFieldcan not only solve this problem but also implement custom requirements.
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description String[]alternateNamesUsing multiple different field names when deserializingClass<?>arrayToMapDuplicateHandlerStringarrayToMapKeyStringdefaultValuebooleandeserializeWhether the field is deserialized during deserialization, defaulttureJSONReader.Feature[]deserializeFeaturesSpecifyJSONReader.Features to use features when deserializingClassdeserializeUsingSpecifies thatObjectReaderis used when deserializingStringformatIf the field isDate, then please define the date formatbooleanjsonDirectStringlabelStringlocaleStringnameSpecify theStringas the key name in JSONintordinalThe order of the fields during serialization and output in ascending orderbooleanrequiredProperty that indicates whether a value (which may be explicit null) is expected for property during deserialization or not.StringschemabooleanserializeWhether the field is serialized during serialization, defaulttureJSONWriter.Feature[]serializeFeaturesSpecifyJSONWriter.Features to use features when serializing outputClassserializeUsingSpecifies thatObjectWriteris used when serializingbooleanunwrappedIf true, serialize and deserialize the field's internal propertiesbooleanvalueClasswriteUsingDeprecated.
-
-
-
-
label
String label
- Default:
- ""
-
-
-
alternateNames
String[] alternateNames
Using multiple different field names when deserializing- Default:
- {}
-
-
-
writeUsing
@Deprecated Class writeUsing
Deprecated.Specifies thatObjectWriteris used when serializing- Default:
- java.lang.Void.class
-
-
-
serializeUsing
Class serializeUsing
Specifies thatObjectWriteris used when serializing- Default:
- java.lang.Void.class
-
-
-
deserializeUsing
Class deserializeUsing
Specifies thatObjectReaderis used when deserializing- Default:
- java.lang.Void.class
-
-
-
deserializeFeatures
JSONReader.Feature[] deserializeFeatures
SpecifyJSONReader.Features to use features when deserializing- Default:
- {}
-
-
-
serializeFeatures
JSONWriter.Feature[] serializeFeatures
SpecifyJSONWriter.Features to use features when serializing output- Default:
- {}
-
-
-
defaultValue
String defaultValue
- Since:
- 1.2.61
- Default:
- ""
-
-
-
locale
String locale
- Default:
- ""
-
-
-
schema
String schema
- Default:
- ""
-
-
-
required
boolean required
Property that indicates whether a value (which may be explicit null) is expected for property during deserialization or not. If expected,ObjectReadershould indicate this as a validity problem (usually by throwing an exception, but this may be sent via problem handlers that can try to rectify the problem, for example, by supplying a default value).- Since:
- 2.0.20
- Default:
- false
-
-
-
arrayToMapKey
String arrayToMapKey
- Since:
- 2.0.52
- Default:
- ""
-
-
-
arrayToMapDuplicateHandler
Class<?> arrayToMapDuplicateHandler
- Since:
- 2.0.52
- Default:
- java.lang.Void.class
-
-