Changing Default JSON Time Format with RESTEasy 3.x

前端 未结 3 877
梦谈多话
梦谈多话 2021-02-13 22:35

I am using RESTEasy to implement a REST Service using JSON serialization. Currently, Dates are getting serialized to milliseconds since 1970. To improve compatibility, I would

3条回答
  •  逝去的感伤
    2021-02-13 23:33

    Just annotate your fields with (note the string literal could be externalized/referred from a constant):

    @javax.json.bind.annotation.JsonbDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'")
    Date myDate;
    

提交回复
热议问题