This does NOT require custom serializers but simple annotation:

@JsonFormat(shape=JsonFormat.Shape.ARRAY)
public class UserModel {
    // ...
}
Answer from StaxMan on Stack Overflow
Discussions

java - How to use Jackson to deserialise an array of objects - Stack Overflow
The Jackson data binding documentation indicates that Jackson supports deserialising "Arrays of all supported types" but I can't figure out the exact syntax for this. For a single object I would do More on stackoverflow.com
🌐 stackoverflow.com
java - spring api - jackson serialize an object to an array - Stack Overflow
Bring the best of human thought and AI automation together at your work. Explore Stack Internal ... Save this question. Show activity on this post. I'm encountering a problem about the way jackson serialize an object. More on stackoverflow.com
🌐 stackoverflow.com
spring - Custom serializer for Object array using jackson - Stack Overflow
I’m Jody, the Chief Product and Technology Officer at Stack Overflow. Let’s... 0 Jackson - Custom serializer for propeties inside object More on stackoverflow.com
🌐 stackoverflow.com
Serialization Of Polymorphic Array Failing
I am able to seriazlize an individual object successfully and it is writing the type information as part of serialized data. However, the same is not happening if I store the objects in a list and serialize it. It seems this issue was fixed in 1.6.3 (http://jira.codehaus.org/browse/JACKSON-362) More on github.com
🌐 github.com
8
February 7, 2015
🌐
Medium
cowtowncoder.medium.com › serializing-java-pojo-as-json-array-with-jackson-2-more-compact-output-510a85c019d4
Serializing Java POJO as JSON Array with Jackson 2: more compact output | by @cowtowncoder | Medium
January 14, 2017 - The key is annotation @JsonFormat and its property shape which allows altering kind of JSON value that will be produced on serialization: it may be — for example — be used to choose between numeric (timestamp) and textual (ISO-8601) serialization of Date/Time values. In this case we want to indicate that POJO that would normally be serialized as JSON Object should instead be serialized as JSON Array.
🌐
Baeldung
baeldung.com › home › json › jackson › jackson – unmarshall to collection/array
Jackson - Unmarshall to Collection/Array | Baeldung
April 26, 2024 - Reading the same JSON Array into a Java Collection is a bit more difficult – by default, Jackson will not be able to get the full generic type information and will instead create a collection of LinkedHashMap instances: @Test public void givenJsonArray_whenDeserializingAsListWithNoTypeInfo_thenNotCorrect() throws JsonParseException, JsonMappingException, IOException { ObjectMapper mapper = new ObjectMapper(); List<MyDto> listOfDtos = Lists.newArrayList( new MyDto("a", 1, true), new MyDto("bc", 3, false)); String jsonArray = mapper.writeValueAsString(listOfDtos); List<MyDto> asList = mapper.readValue(jsonArray, List.class); assertThat((Object) asList.get(0), instanceOf(LinkedHashMap.class)); }
🌐
Mosy
mosy.tech › blog › java-json-jackson-serialization-objectmapper
Java and JSON – Jackson Serialization with ObjectMapper | Mosy
July 31, 2018 - This example uses a more realistic ... those objects in a meaningful way, you need to register the JavaTimeModule, contained in the dependency library jackson-datatype-jsr310....
🌐
Studytrails
studytrails.com › 2016 › 09 › 12 › java-jackson-serialization-list
Java json – jackson List serialization – Studytrails
Once an object has a type-string, you can serialize it directly and see the typestring: e.g. {“type”:”elephant”,”name”:”Manny”}. Object[] ought to be exactly the same as ‘[‘ + serialize(it.next()) + ‘,’ + … ‘]’. Which produces the correct result! There’s no real excuse for a serialized array of Objects being anything except an array of serialized objects separated by ‘,’ and surrounded by ‘[]’.
Find elsewhere
🌐
GeeksforGeeks
geeksforgeeks.org › java › deserialize-json-array-to-a-single-java-object-with-jackson
Deserialize JSON Array to a Single Java Object with Jackson - GeeksforGeeks
July 23, 2025 - To deserialize an array to an object in Java, we typically use the Jackson library. Jackson unlocks diverse use cases, such as transforming API responses or manipulating structured data within an application.
🌐
GitHub
github.com › FasterXML › jackson-databind › wiki › Serialization-features
Serialization features · FasterXML/jackson-databind Wiki · GitHub
Jackson defines a set of features that relate to serialization (writing Java objects as JSON), and that can be changed on per-call basis (by using ObjectWriter).
Author: FasterXML
Top answer
1 of 1
2

If you only want to serialize Date instances, then the best idea would be to write a custom serializer for Date type only, but I suspect this is not an option.

What is more - Object[] is quite a broad specification and it may possibly conflict with other data that is to be serialized in your system. Maybe creating a wrapper class like that:

class MyWrapper {
   Object[] objects;
}

And writing a specialized serializer for this particular wrapper class would be better idea.

What is even more (and this is solution for your problem) - if you are serializing Array then it is on you to keep its syntax proper (the output from your serializer does not contain array-start [ and array-end ] tags). To fix that you should add writeStartArray() and writeEndArray() method calls:

@Override
public void serialize(Object[] array,
                      JsonGenerator gen,
                      SerializerProvider provider)
        throws IOException, JsonProcessingException {
    gen.writeStartArray();
    // processing array
    gen.writeEndArray();
}

And the last thing :) If you don't want to serialize other types in a custom way - you can just write:

@Override
public void serialize(Object[] array,
                      JsonGenerator gen,
                      SerializerProvider provider)
        throws IOException, JsonProcessingException {
    gen.writeStartArray();
    for(Object tempObject : array) {
        if(tempObject instanceof Date) {
            gen.writeString(tempObject.toString());
        } else {
            gen.writeObject(tempObject);
        }
    }
    gen.writeEndArray();
}

PS. It would be also a good idea to use some specialized date formatting utility like SimpleDateFormat instead of relying on Date#toString method unless you really want to have this format

🌐
Medium
medium.com › @chethanbandi › serializing-array-of-raw-strings-using-jackson-7b3ed3347c10
serializing array of raw strings using jackson | by Chethan Bandi | Medium
February 1, 2018 - Map<String, String> field1 = new LinkedHashMap<>(2);field1.put("field", "name");field1.put("type", "string");Map<String, String> field2 = new LinkedHashMap<>(2);field2.put("field", "age");field2.put("type", "number");List<Map<String, String>> meta = Arrays.asList(field1, field2);// The list content contains the raw json stringsList<String> content = new ArrayList<>(2);content.add("{\"name\":\"person A\", \"age\":20 }");content.add("{\"name\":\"person B\", \"age\":20 }"); Serialize it using Jackson · ObjectMapper mapper = new ObjectMapper();ObjectNode resp = mapper.createObjectNode();resp.putPOJO("meta", meta);ArrayNode con = resp.putArray("content");content.stream().map(RawValue::new).forEachOrdered(con::addRawValue);System.out.println(mapper.writeValueAsString(resp)); Json ·
🌐
Oracle
blogs.oracle.com › javamagazine › java-json-serialization-jackson
Looking for a fast, efficient way to serialize and share Java objects? Try Jackson.
This means that if your objects depend on Java 8 APIs directly (such as classes from java.time), the serialization must use a specific Java 8 module (JavaTimeModule). This class must be registered when the mapper is created—it is not available by default. To handle that requirement, you will also need to add a couple of extra dependencies to the Jackson libraries’ default.
🌐
GitHub
github.com › FasterXML › jackson-databind › issues › 699
Serialization Of Polymorphic Array Failing · Issue #699 · FasterXML/jackson-databind
February 7, 2015 - @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY,property = "type") @JsonSubTypes({@Type(value = Derived.class, name = "derived")}) public abstract class Base { } public class Derived extends Base { private String field; public String getField() { return field; } public void setField(String field) { this.field = field; } } public class Test { public static void main(String[] args) throws JsonProcessingException { ObjectMapper mapper = new ObjectMapper(); Derived d = new Derived(); d.setField("Name"); Base b = d; System.out.println(mapper.writeValueAsString(b)); List<Base> list = new ArrayList<Base>(); list.add(d); System.out.println(mapper.writeValueAsString(list)); } }
Author: FasterXML
🌐
Stack Overflow
stackoverflow.com › questions › 72100741 › java-jackson-json-serialisation-how-to-write-mapstring-object-to-array-of-obj
Java/Jackson JSON serialisation: How to write Map<String,Object> to Array of objects? - Stack Overflow
May 3, 2022 - But the alternative solution to achieve such serialization - is simply to convert Map to the Set<Map.Entry> Solution 1, @JsonGetter with converting Map->Set · @Data @NoArgsConstructor public class B { private Map<String,Object> dummyField = new HashMap<>(); @JsonGetter("dummyField") public Set<Map.Entry<String,Object>> getDummyFieldEntrySet() { return dummyField.entrySet(); } @JsonSetter("dummyField") public void setDummyFieldEntrySet(Set<Map.Entry<String,Object>> value) { dummyField = value.stream().collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); } } }
🌐
Baeldung
baeldung.com › home › json › jackson › intro to the jackson objectmapper
Intro to the Jackson ObjectMapper | Baeldung
December 9, 2025 - How to use the @JsonView annotation in Jackson to perfectly control the serialization of your objects (without and with Spring).