javajsonbquarkusyasson

Quarkus JsonB change to different timezone


quarkus jsonb is deserializing json in UTC. How can I configure a different timezone?

public class AtendimentoDTO {
    public Integer id;

    @JsonbDateFormat("dd/MM/yyyy HH:mm:ss")
    private Date dataAtualizacao;
}

Output in UTC:

"dataAtualizacao": "23/05/2020 21:55:57"

maven dependency:

<dependency>
    <groupId>io.quarkus</groupId>
    <artifactId>quarkus-resteasy-jsonb</artifactId>
</dependency>

Solution

  • I was able to fix it by changing the provider to jackson and using:

    @JsonFormat(shape = JsonFormat.Shape.STRING, 
      pattern = "dd/MM/yyyy HH:mm:ss", timezone = "GMT-3")