You can put @JsonSerialize(using = CustomDateSerializer.class) over any date field of object to be serialized.

public class CustomDateSerializer extends SerializerBase<Date> {

    public CustomDateSerializer() {
        super(Date.class, true);
    }

    @Override
    public void serialize(Date value, JsonGenerator jgen, SerializerProvider provider)
        throws IOException, JsonProcessingException {
        SimpleDateFormat formatter = new SimpleDateFormat("EEE MMM dd yyyy HH:mm:ss 'GMT'ZZZ (z)");
        String format = formatter.format(value);
        jgen.writeString(format);
    }

}
Answer from Moesio on Stack Overflow
🌐
Baeldung
baeldung.com › home › json › jackson › jackson – custom serializer
Jackson - Custom Serializer | Baeldung
May 11, 2024 - Control your JSON output with Jackson 2 by using a Custom Serializer.
🌐
Medium
medium.com › @bubu.tripathy › json-serialization-and-deserialization-in-java-2a3f08266b70
JSON Serialization and Deserialization in Java | by Bubu Tripathy | Medium
April 9, 2023 - The FasterXML Jackson library is a popular Java library used for working with JSON data. It provides a number of annotations that can be used to customize the serialization and deserialization of JSON data.
🌐
Oracle
docs.oracle.com › middleware › 1213 › toplink › java-reference › org › eclipse › persistence › sessions › serializers › JSONSerializer.html
JSONSerializer (Oracle Fusion Middleware Java API Reference for Oracle TopLink)
public JSONSerializer(java.lang.String packageName) public JSONSerializer(javax.xml.bind.JAXBContext context) public java.lang.Object serialize(java.lang.Object object, Session session) Specified by: serialize in interface Serializer · Overrides: serialize in class XMLSerializer ·
🌐
Medium
medium.com › @alexandre.therrien3 › personalized-serializer-and-deserializer-using-java-gson-library-c079de3974d4
Building a Personalized Serializer and Deserializer using Java Gson Library | by Alex Therrien | Medium
June 2, 2020 - import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonPrimitive; import com.google.gson.JsonSerializationContext; import com.google.gson.JsonSerializer; import java.lang.reflect.Type; /** * * @author user */ public class SomeSerializer implements JsonSerializer<SomeObject> { public JsonElement serialize(SomeObject someObject, Type type, JsonSerializationContext jsonSerializationContext) { } } (Code block 1.1) Where SomeObject is the object that you desire to read to put into a JSON file.
🌐
Javadoc.io
javadoc.io › doc › com.fasterxml.jackson.core › jackson-databind › 2.9.1 › com › fasterxml › jackson › databind › JsonSerializer.html
JsonSerializer - jackson-databind 2.9.1 javadoc
https://javadoc.io/doc/com.fasterxml.jackson.core/jackson-databind · Current version 2.9.1 · https://javadoc.io/doc/com.fasterxml.jackson.core/jackson-databind/2.9.1 · package-list path (used for javadoc generation -link option) https://javadoc.io/doc/com.fasterxml.jackson.core/jackson-databind/2.9.1/package-list ·
🌐
Adobe Developer
developer.adobe.com › experience-manager › reference-materials › 6-5 › javadoc › com › fasterxml › jackson › databind › JsonSerializer.html
JsonSerializer (The Adobe AEM Quickstart and Web Application.)
java.lang.Object · com.fasterxml.jackson.databind.JsonSerializer<T> All Implemented Interfaces: JsonFormatVisitable · Direct Known Subclasses: JsonSerializer.None, StdSerializer, TypeWrappedSerializer · public abstract class JsonSerializer<T> extends java.lang.Object implements JsonFormatVisitable ·
🌐
Spring
docs.spring.io › spring-kafka › api › org › springframework › kafka › support › serializer › JsonSerializer.html
JsonSerializer (Spring for Apache Kafka 4.1.1 API)
java.lang.Object · org.springframework.kafka.support.serializer.JsonSerializer<T> Type Parameters: T - class of the entity, representing messages ·
Find elsewhere
🌐
Mkyong
mkyong.com › home › java › jackson custom serializer and deserializer examples
Jackson Custom Serializer and Deserializer Examples | mkyong.com
May 6, 2024 - LocalDateSerializer.java · package com.mkyong.json.jackson.tips; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.JsonSerializer; import com.fasterxml.jackson.databind.SerializerProvider; import java.io.IOException; import java.time.LocalDate; import java.time.format.DateTimeFormatter; public class LocalDateSerializer extends JsonSerializer<LocalDate> { private static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-yyyy"); @Override public void serialize(LocalDate value, JsonGenerator gen, SerializerProvider serializers) throws IOException { gen.writeString(formatter.format(value)); } } The following example creates a custom deserializer to convert the JSON field that contains dates as strings, and we want to convert them to the Localdate type.
🌐
DEV Community
dev.to › alaugks › create-a-custom-jackson-jsonserializer-und-jsondeserializer-for-mapping-values-48h7
Create a custom Jackson JsonSerializer und JsonDeserializer for mapping values - DEV Community
March 9, 2025 - So if you want to do the mapping, you would need a JsonSerializer to write the FieldValueID (String) for salutation and marketingInformation and a JsonDeserializer to set the value for stalutation (String) and marketingInformation (Boolean).
🌐
Fasterxml
fasterxml.github.io › jackson-databind › javadoc › 2.9 › com › fasterxml › jackson › databind › JsonSerializer.html
JsonSerializer (jackson-databind 2.9.0 API)
java.lang.Object · com.fasterxml.jackson.databind.JsonSerializer<T> All Implemented Interfaces: JsonFormatVisitable · Direct Known Subclasses: JsonSerializer.None, StdSerializer, TypeWrappedSerializer · public abstract class JsonSerializer<T> extends Object implements JsonFormatVisitable ·
🌐
HowToDoInJava
howtodoinjava.com › home › gson › gson – custom serialization and deserialization
Gson - JsonSerializer and JsonDeserializer Example - HowToDoInJava
October 1, 2022 - Learn to use custom serialization and deserialization using two interfaces Gson JsonSerializer and JsonDeserializer to convert between json and java object.
🌐
Saxonica
saxonica.com › html › documentation10 › javadoc › net › sf › saxon › serialize › JSONSerializer.html
JSONSerializer
java.lang.Object · net.sf.saxon.event.SequenceReceiver · net.sf.saxon.event.SequenceWriter · net.sf.saxon.serialize.JSONSerializer · All Implemented Interfaces: javax.xml.transform.Result, Receiver, ReceiverWithOutputProperties · public class JSONSerializer extends SequenceWriter implements ReceiverWithOutputProperties ·
🌐
Jodd
json.jodd.org › serializer
Serializer | Jodd JSON
April 28, 2023 - JsonSerializer knows to serializes primitives, collections, strings, integers, and various Java types that are commonly used as bean properties.
🌐
Fasterxml
fasterxml.github.io › jackson-databind › javadoc › 2.8 › com › fasterxml › jackson › databind › JsonSerializer.html
JsonSerializer (jackson-databind 2.8.0 API) - FasterXML
java.lang.Object · com.fasterxml.jackson.databind.JsonSerializer<T> All Implemented Interfaces: JsonFormatVisitable · Direct Known Subclasses: JsonSerializer.None, StdSerializer, TypeWrappedSerializer · public abstract class JsonSerializer<T> extends Object implements JsonFormatVisitable ·
🌐
SourceForge
json-lib.sourceforge.net › apidocs › net › sf › json › JSONSerializer.html
JSONSerializer (Overview (json-lib jdk 1.3 API))
java.lang.Object net.sf.json.JSONSerializer · public class JSONSerializer · extends Object · Transforms java objects into JSON and back.
🌐
Fasterxml
fasterxml.github.io › jackson-core › javadoc › 1.9 › org › codehaus › jackson › map › JsonSerializer.html
JsonSerializer (Jackson JSON Processor)
java.lang.Object · org.codeha... JsonSerializer<T> extends Object · Abstract class that defines API used by ObjectMapper (and other chained JsonSerializers too) to serialize Objects of arbitrary types into JSON, using provided JsonGenerator....
🌐
Adobe
experienceleague.adobe.com › en › tools › aem-api-documentation › 6-5-lts › javadoc › com › fasterxml › jackson › databind › JsonSerializer.html
JsonSerializer (The Adobe AEM Quickstart and Web Application. 6.6.0)
java.lang.Object · com.fasterxml.jackson.databind.JsonSerializer<T> All Implemented Interfaces: JsonFormatVisitable · Direct Known Subclasses: JsonSerializer.None, StdSerializer, TypeWrappedSerializer · public abstract class JsonSerializer<T> extends java.lang.Object implements JsonFormatVisitable ·
🌐
SourceForge
flexjson.sourceforge.net › javadoc › flexjson › JSONSerializer.html
JSONSerializer (flexjson 3.2-SNAPSHOT API)
JSONSerializer is the main class for performing serialization of Java objects to JSON. JSONSerializer by default performs a shallow serialization. While this might seem strange there is a method to this madness. Shallow serialization allows the developer to control what is serialized out of ...