First, define POJOs for mapping your request object:

public class RequestObj implements Serializable{

    private List<Long> ids;

    private UsuarioDTO user;

    /* getters and setters here */

}

public class UsuarioDTO implements Serializable{

    private String name;
    private String email;

    /* getters and setters here */

}

And then modify your endpoint:

@PostMapping(value = "/sendToOficial")
public ResponseEntity<?> sendToOficial(@RequestBody RequestObj payload) {

In this way you also do not need to use an ObjectMapper. Just call payload.getIds().

Consider also that in this way if payload changes you'll need only to change RequestObj definition, while using ObjectMapper would force you to update also your endpoint in an important way. It's better and safer to separate payload representation from control logic.

Answer from Lorelorelore on Stack Overflow
🌐
IQCode
iqcode.com › code › other › objectmapper-convertvalue-to-list-of-objects
objectmapper convertvalue to list of objects Code Example
October 28, 2021 - List&lt;MyClass&gt; myObjects = mapper.readValue(jsonInput, new TypeReference&lt;List&lt;MyClass&gt;&gt;(){});
🌐
Makeinjava
makeinjava.com › home › convert list of objects to/from json in java (jackson objectmapper/ example)
Convert list of objects to/from JSON in java (jackson objectmapper/example)
January 1, 2024 - Convert JSON to List of Person objects //Define Custom Type reference for List<Person> type TypeReference<List<Person>> mapType = new TypeReference<List<Person>>() {}; List<Person> jsonToPersonList = objectMapper.readValue(arrayToJson, mapType); System.out.println("\n2.
🌐
GitHub
github.com › FasterXML › jackson-core › issues › 494
Object convert to Map let Set convert to ArrayList · Issue #494 · FasterXML/jackson-core
October 23, 2018 - Hello, I found a problem when write Object to Map, the object contains a Set type property, but after the convertValue method, I found that the propertie type in the Map becomes ArrayList, no solution found through google search, view the source code Found that the underlying is using ArrayList, there is no way to use HashSet. public class Test { private Set<String> tags; } public class Util { public static ObjectMapper objectMapper; static { objectMapper = new ObjectMapper(); objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); } public static void main(String[] args) { Test t = new Test(); Set<String> tags = new HashSet(); tags.add("1"); tags.add("2"); t.setTags(tags); Map map = objectMapper.convertValue(t, Map.class); } } the source code default use ArrayList, Cannot be automatically determined by the object's property type。 ·
Author: FasterXML
🌐
Attacomsian
attacomsian.com › blog › jackson-convert-json-array-to-from-java-list
Convert JSON array to a list using Jackson in Java
November 6, 2022 - Now we can use the readValue() method from the ObjectMapper class to transform the above JSON array to a list of User objects, as shown below:
🌐
Devgex
devgex.com › en › article › 00033074
Converting LinkedHashMap to Complex Objects in Jackson Deserialization: A Solution Using ObjectMapper.convertValue() - DevGex
December 1, 2025 - However, when dealing with collections containing nested complex objects, developers frequently encounter a specific issue: Jackson may deserialize custom object lists into List<LinkedHashMap> instead of the expected List<SomeObject>. This phenomenon stems from Java's type erasure mechanism, where Jackson cannot accurately infer the concrete implementation class of generic types at runtime. Jackson provides the ObjectMapper.convertValue() method as a standard solution to this problem.
Find elsewhere
🌐
Medium
medium.com › @salvipriya97 › objectmapper-and-its-methods-examples-in-java-4a4cab75cb6b
ObjectMapper and its methods examples in Java | by Priya Salvi | Medium
June 25, 2024 - import com.fasterxml.jackson.databind.ObjectMapper; import java.util.Map; public class Main { public static void main(String[] args) { ObjectMapper objectMapper = new ObjectMapper(); Person person = new Person("John", 30); try { Map<String, Object> map = objectMapper.convertValue(person, Map.class); System.out.println(map); // Output: {name=John, age=30} } catch (Exception e) { e.printStackTrace(); } } } Person.java: public class Person { private String name; private int age; public Person() { } public Person(String name, int age) { this.name = name; this.age = age; } // Getters and setters public String getName() { return name; } public void setName(String name) { this.name = name; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } } UnrecognizedPropertyException: Cause: JSON contains fields not present in the Java class.
🌐
Baeldung
baeldung.com › home › spring › spring boot › get list of json objects with spring resttemplate
Get list of JSON objects with Spring RestTemplate | Baeldung
December 11, 2025 - ObjectMapper mapper = new ObjectMapper(); We can declare it inline, though this is usually done as a private static final member of the class. Lastly, we are ready to extract the usernames: return Arrays.stream(objects) .map(object -> mapper.convertValue(object, User.class)) .map(User::getName) .collect(Collectors.toList()); With this method, we can essentially read an array of anything into an Object array in Java.
🌐
Java Code Geeks
javacodegeeks.com › home › core java
Jackson JsonNode to Java Collections - Java Code Geeks
July 8, 2024 - In this method, we use the ObjectMapper class along with TypeReference to convert a JsonNode to a typed List or Map. The TypeReference class allows us to specify the target type in a generic way.
🌐
Jenkov
jenkov.com › tutorials › java-json › jackson-objectmapper.html
Jackson ObjectMapper
Notice the TypeReference parameter passed to readValue(). This parameter tells Jackson to read a List of Car objects. The Jackson ObjectMapper can also read a Java Map from a JSON string. This can be useful if you do not know ahead of time the exact JSON structure that you will be parsing.
🌐
Baeldung
baeldung.com › home › json › jackson › convert jackson jsonnode to typed collection
Convert Jackson JsonNode to Typed Collection | Baeldung
June 21, 2025 - Then, we register this module with the ObjectMapper instance. By doing this, we instruct the ObjectMapper to use CustomPersonListDeserializer whenever a List needs to be deserialized. When we call the convertValue() method next, the deserializer is used to return the output list.
🌐
Adobe Developer
developer.adobe.com › experience-manager › reference-materials › cloud-service › javadoc › com › fasterxml › jackson › databind › ObjectMapper.html
ObjectMapper (The Adobe Experience Manager SDK 2022.11.9850.20221116T162329Z-220900)
ObjectMapper provides functionality for reading and writing JSON, either to and from basic POJOs (Plain Old Java Objects), or to and from a general-purpose JSON Tree Model (JsonNode), as well as related functionality for performing conversions. It is also highly customizable to work both with different styles of JSON content, and to support more advanced Object concepts such as polymorphism and Object identity.
🌐
TutorialsPoint
tutorialspoint.com › jackson › jackson_objectmapper.htm
Jackson - ObjectMapper Class
ObjectMapper class ObjectMapper provides functionality for reading and writing JSON, either to and from basic POJOs (Plain Old Java Objects), or to and from a general-purpose JSON Tree Model (JsonNode), as well as related functionality for performing conversions.