From what I know, there are two main ways to enforce for all of your date fields this behavior:
@JsonFormat
annotation to enforce the format in your model, something like this:@Schema(description = "Reg date")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX")
private OffsetDateTime regDate;
- You can also try to configure Jackson globally, as I assume you're running this in Spring Boot. If I am correct, read this article for how you can do so: https://www.baeldung.com/spring-boot-customize-jackson-objectmapper. By configuring Jackson globally, you can avoid the need of annotating each individual field.