@JsonFormat(shape = JsonFormat.Shape.STRING)
时间: 2023-08-24 18:14:03 浏览: 107
@JsonFormat的使用jackson-annotations
4星 · 用户满意度95%
@JsonFormat(shape = JsonFormat.Shape.STRING)是用来表示json序列化的一种格式或者类型。它可以应用于JavaBean中的属性,用来指定该属性在序列化为json时的格式。具体来说,它可以指定日期的格式、时区等信息。例如,可以使用@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")来指定日期属性的格式为"yyyy-MM-dd HH:mm:ss",时区为"GMT+8"。这样,在将该属性序列化为json时,会按照指定的格式进行格式化。\[1\]\[2\]\[3\]
#### 引用[.reference_title]
- *1* [@JsonFormat 使用方法](https://blog.csdn.net/asd26655/article/details/125252564)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* [如何使用@JsonFormat](https://blog.csdn.net/weixin_41860630/article/details/101928062)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control,239^v3^insert_chatgpt"}} ] [.reference_item]
- *3* [SpringBoot&fastjson中用@JSONFormat格式化日期格式/指定日期属性的格式](https://blog.csdn.net/moshowgame/article/details/84139443)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文