Tag: class RET causes the BSP Sage case to exist annotated JSON
@JsonAutoDetect (fieldvisibility = visibility.any, gettervisibility = visibility.none, isgettervisibility = Visibility.none)
The purpose of this annotation is to use the property name to go to JSON. prevent irregular attribute errors, such as app_id
@JsonIgnoreProperties (Ignoreunknown = True)
The purpose of this annotation is that the JSON-to-object is to prevent an error from passing in a JSON string that contains a nonexistent property.
Case:
1@JsonAutoDetect (fieldvisibility = visibility.any, gettervisibility = visibility.none, isgettervisibility =Visibility.none)2@JsonIgnoreProperties (Ignoreunknown =true)3 Public classUnifiedpayorderresponse {4 5 PrivateString Code;6 7 PrivateString message;8 9 PrivateString Main_order_code;Ten One PrivateString app_id; A - PublicString GetCode () { - returnCode; the } - - Public voidSetcode (String code) { - This. Code =Code; + } - + PublicString getMessage () { A returnmessage; at } - - Public voidsetmessage (String message) { - This. Message =message; - } - in PublicString Getmain_order_code () { - returnMain_order_code; to } + - Public voidSetmain_order_code (String main_order_code) { the This. Main_order_code =Main_order_code; * } $ Panax Notoginseng PublicString getapp_id () { - returnapp_id; the } + A Public voidsetapp_id (String app_id) { the This. app_id =app_id; + } - $}
Java Jackson ignores non-existent attribute fields and goes to JSON by property name