No, you can not use type variables like T this way with TypeReference: you must pass actual parameterization. This is because there is no runtime information whatsoever associated with T here: it is just a placeholder. So it is effectively treated as java.lang.Object.

But you can build structured types programmatically using TypeFactory (instance of which is available via ObjetMapper.getTypeFactory()). You will still need Class instances that represent key and value types, but with this information it is possible to construct JavaType values that contain full type information that you need.

Answer from StaxMan on Stack Overflow
🌐
Java Tips
javatips.net › api › com.fasterxml.jackson.core.type.typereference
Java Examples for com.fasterxml.jackson.core.type.TypeReference
@Test public void serialization() { SimpleTrigger trigger = TriggerBuilder.newTrigger().forJob("testJob", "testGroup").withIdentity("testTrigger", "testTriggerGroup").usingJobData("timeout", 5).withDescription("A description!").withSchedule(SimpleScheduleBuilder.repeatHourlyForever()).build(); Map<String, String> triggerMap = mapper.convertValue(trigger, new TypeReference<HashMap<String, String>>() { }); assertThat(triggerMap, hasKey("name")); assertEquals("testTrigger", triggerMap.get("name")); assertThat(triggerMap, hasKey("group")); assertEquals("testTriggerGroup", triggerMap.get("group"));
🌐
Northcoder
northcoder.com › post › jackson-object-mapper-which-way-is
Jackson's ObjectMapper and TypeReference | northCoder
January 15, 2021 - Or, I can use Jackson’s TypeReference with my ObjectMapper: ... This new TypeReference<Map<String, Object>>() {} means the map is no longer untyped. It creates the exact same end result as the first example.
🌐
Fasterxml
fasterxml.github.io › jackson-databind › javadoc › 2.5 › com › fasterxml › jackson › databind › ObjectMapper.html
ObjectMapper (jackson-databind 2.5.0 API)
public <T> T convertValue(Object fromValue, com.fasterxml.jackson.core.type.TypeReference<?> toValueTypeRef) throws IllegalArgumentException · Throws: IllegalArgumentException · public <T> T convertValue(Object fromValue, JavaType toValueType) throws IllegalArgumentException ·
🌐
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.
Find elsewhere
🌐
Fasterxml
fasterxml.github.io › jackson-core › javadoc › 1.9 › org › codehaus › jackson › type › class-use › TypeReference.html
Uses of Class org.codehaus.jackson.type.TypeReference (Jackson JSON Processor)
JavaScript is disabled on your browser · Overview · Package · Class · Deprecated · Index · Frames · No Frames · All Classes · Uses of Class org.codehaus.jackson.type.TypeReference
🌐
Baeldung
baeldung.com › home › json › jackson › map serialization and deserialization with jackson
Map Serialization and Deserialization with Jackson | Baeldung
January 8, 2024 - String jsonInput = "{\"key\": \"value\"}"; TypeReference<HashMap<String, String>> typeRef = new TypeReference<HashMap<String, String>>() {}; Map<String, String> map = mapper.readValue(jsonInput, typeRef); We use Jackson’s ObjectMapper, as ...
🌐
GitHub
github.com › FasterXML › jackson-databind › issues › 1490
TypeReference doesn't work with generic type parameter · Issue #1490 · FasterXML/jackson-databind
January 8, 2017 - public <T> Map<String, T> convert(String str) throws IOException { ObjectMapper mapper = new ObjectMapper(); return mapper.readValue(str, new TypeReference<Map<String, T>>() {}); } The example usage: Map<String, Foo> map = obj.convert(jsonString); ...
Author: FasterXML
🌐
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.
🌐
Jenkov
jenkov.com › tutorials › java-json › jackson-objectmapper.html
Jackson ObjectMapper
String jsonArray = "[{\"brand\":\"ford\"}, {\"brand\":\"Fiat\"}]"; ObjectMapper objectMapper = new ObjectMapper(); List<Car> cars1 = objectMapper.readValue(jsonArray, new TypeReference<List<Car>>(){});
🌐
Baeldung
baeldung.com › home › json › jackson › deserialize generic type with jackson
Deserialize Generic Type with Jackson | Baeldung
September 17, 2025 - If the type parameter T is not static, we need to choose JavaType instead of TypeReference to pass the type information for deserialization. ObjectMapper provides such methods, which are recommended now from Jackson 2.5, and we can use TypeFactory to construct the JavaType object with our type parameter:
🌐
GitHub
github.com › FasterXML › jackson-databind › issues › 3129
TypeReference not working as expected in generic context · Issue #3129 · FasterXML/jackson-databind
April 22, 2021 - Describe the bug Using TypeReference in a generic context doesn't convert to the expected type correctly and results in a ClassCastException. ... public class Main { private static final ObjectMapper objectMapper = new ObjectMapper(); public static void main(String[] args) throws JsonProcessingException { String json = "{\"name\": \"Steve\"}"; Person p = getResult(json); } private static <T> T getResult(String json) throws JsonProcessingException { return objectMapper.readValue(json, new TypeReference<T>() {}); } private static class Person { public String name; } }