I think you need to make sure that you register the jackson kotlin module which e.g. adds support for data classes.

Module that adds support for serialization/deserialization of Kotlin classes and data classes. Previously a default constructor must have existed on the Kotlin object for Jackson to deserialize into the object. With this module, single constructor classes can be used automatically, and those with secondary constructors or static factories are also supported.

With that you can create an ObjectMapper that already has this module registered using com.fasterxml.jackson.module.kotlin.ExtensionsKt#jacksonObjectMapper. (Note how you can also use one of the extensions it provides to avoid stating the payload class)

var mapper = jacksonObjectMapper()
val movie: Movie = mapper.readValue(payload)

As an alternative you can still create the object mapper and register the module using the usual API:

var mapper = ObjectMapper()
mapper.registerModule(KotlinModule())
Answer from Mathias Dpunkt on Stack Overflow
🌐
BezKoder
bezkoder.com › home › kotlin – convert json to object and vice versa using jackson
Kotlin – Convert JSON to Object and vice versa using Jackson - BezKoder
December 13, 2020 - Jackson is a Java/Kotlin library for converting Java/Kotlin Objects into JSON representation, also a JSON string to an equivalent Java/Kotlin object.
🌐
Baeldung
baeldung.com › home › libraries › jackson support for kotlin
Jackson Support for Kotlin | Baeldung on Kotlin
August 26, 2026 - As we know, we can’t pass null values to non-nullable types in Kotlin. For instance, the name and studio parameters in the Movie class won’t accept null values because of their type. Consequently, Jackson should somehow handle this in the deserialization process. As a matter of fact, when one of the required properties is missing in the JSON string, Jackson will fail to deserialize that JSON to the target Kotlin type.
Discussions

spring - Parse Json String into Kotlin Object throws InvalidDefinitionException with Jackson - Stack Overflow
But the Json does not contain a Id. The Id in this Object is the Primary Key in my Database. ... I think you need to make sure that you register the jackson kotlin module which e.g. More on stackoverflow.com
🌐 stackoverflow.com
java - How to parse JSON in Kotlin? - Stack Overflow
How can I transform a JSON string to object in Kotlin? After that the mapping to the respective classes, I was using StdDeserializer from Jackson. The problem arises at the moment the object had properties that also had to be deserialized into classes. More on stackoverflow.com
🌐 stackoverflow.com
How do I deserialize JSON into a List<SomeType> with Kotlin + Jackson - Stack Overflow
What is the correct syntax to deserialize the following JSON: [ { "id" : "1", "name" : "Blues" }, { "id" : "0", "name" : "Rock" } ] I tried: //Works OK val dtos = mapper.readValue(json More on stackoverflow.com
🌐 stackoverflow.com
json - How to use jackson to deserialize to Kotlin collections - Stack Overflow
List) (as Kotlin makes explicit) ... String>>, not knowing it has to construct Ds. This is worked around by using an anonymous subclass of TypeReference in Java so that Jackson can access the full reified type to deserialize to at run time. Translating Jackson Java code literally to Kotlin, the following thus achieves what you want (and as commented by @eski, notice that the JSON in your example is invalid): val jacksonMapper = ObjectMapper().registe... More on stackoverflow.com
🌐 stackoverflow.com
🌐
Stack Abuse
stackabuse.com › reading-and-writing-json-in-kotlin-with-jackson
Reading and Writing JSON in Kotlin with Jackson
February 27, 2023 - <dependency> <groupId>com.fasterxml.jackson.module</groupId> <artifactId>jackson-module-kotlin</artifactId> <version>2.12.1</version> </dependency> ... Let's take a look at how we can deserialize a JSON object into a Kotlin object. Since we'll want to convert the JSON contents into a Kotlin object, let's define a User data class: data class User ( val id: Int, val username: String, val password: String, val fullName: String )
🌐
Kotlination
kotlination.com › kotlin-convert-object-to-from-json-jackson-2
Convert Object to/from JSON with Jackson 2.x - Kotlination
basic bufferedreader bufferedwriter ... jackson java equivalent json kotlin helloworld kotlin programming lazy initialization list maven object expressions partition postgresql property regex rest api singleton sorting spring boot spring boot kotlin spring jpa spring kotlin string ...
🌐
Mario Fernandez
hceris.com › painless json with kotlin and jackson
Painless JSON with Kotlin and jackson | Mario Fernandez
June 16, 2019 - Since Kotlin 1.3, a new concept called inline classes has been introduced, which might match better with this use case. Jackson has some trouble deserializing it properly in nested objects as of 16/06/19, so I could not replace my data classes with it so far. There is an open issue in Github to follow. Here we get the last piece of the puzzle. We can manually use an ObjectMapper and convert things explicitly.
🌐
Stack Overflow
stackoverflow.com › questions › 34716697 › how-do-i-deserialize-json-into-a-listsometype-with-kotlin-jackson
How do I deserialize JSON into a List<SomeType> with Kotlin + Jackson - Stack Overflow
What is the correct syntax to deserialize the following JSON: [ { "id" : "1", "name" : "Blues" }, { "id" : "0", "name" : "Rock" } ] I tried: //Works OK val dtos = mapper.readValue(json
Find elsewhere
🌐
YouTube
youtube.com › alex gutjahr
How To Deserialize JSON To Kotlin Data Classes Using Spring Boot And Jackson - YouTube
Hey there! In this tutorial, I'll demo how to use Spring Boot and Jackson to deserialize JSON into Kotlin classes. This is handy when consuming third-party A...
Published: March 14, 2021
Views: 4K
🌐
Baeldung
baeldung.com › home › libraries › json string to map
JSON String to Map | Baeldung on Kotlin
September 26, 2023 - fun jsonStringToMapWithJackson(json: String): Map<String, Any> { val objectMapper = jacksonObjectMapper() return objectMapper.readValue<Map<String, Any>>(json) } In this article, we’ve explored how to convert a JSON string into a Map in Kotlin using the Kotlin extension library and three popular JSON libraries: org.json, Jackson, and Gson.
🌐
Medium
medium.com › @js_9757 › polymorphic-json-parsing-with-kotlin-and-jackson-b7a8549fef9c
Polymorphic JSON Parsing with Kotlin and Jackson | by Jens@Fivesec | Medium
August 27, 2024 - Let’s assume our application receives JSON data representing either an airplane or a car. ... { "type": "car", "uuid": "f47ac10b-58cc-4372-a567-0e02b2c3d479", "topSpeed": 250.0, "manufacturer": "BMW" } Our goal is to parse this payload directly into the appropriate target class using a parser operation. Fortunately, Jackson provides us with a JsonTypeInfo annotation.
Top answer
1 of 4
67

With Jackson Kotlin Module current versions, if you import the full module package or the specific extension function you'll have all extension methods available. Such as:

import com.fasterxml.jackson.module.kotlin.*  
val JSON = jacksonObjectMapper()  // keep around and re-use
val myList: List<String> = JSON.readValue("""["a","b","c"]""")

Therefore the Jackson Module for Kotlin will infer the the correct type and you do not need a TypeReference instance.

so your case (slightly renamed and fixed the data class, and JSON):

import com.fasterxml.jackson.module.kotlin.readValue

data class MyData(val a: String, val b: Int)
val JSON = jacksonObjectMapper()  

val jsonStr = """[{"a": "value1", "b": 1}, {"a": "value2", "b": 2}]"""
val myList: List<MyData> = JSON.readValue(jsonStr)

You can also use the form:

val myList = JSON.readValue<List<MyData>>(jsonStr)

Without the import you will have an error because the extension function is not found.

2 of 4
25

TL;DR

With Jackson 2.6.3-2 do as @jason-minard advises and simply use:

import com.fasterxml.jackson.module.kotlin.readValue

val listOfD: List<D> = jacksonMapper.readValue(jsonStr)

Details

There's nothing special about Kotlin wrt to deserializing collections, although you'll need the kotlin jackson module to deserialize data classes without annotations.

Namely, it will require full reified type information in your case in order to keep track of the generic parameter of the list (D) ; otherwise (e.g. if you use readValue(jsonStr, List::class.java)) Jackson will only see it as an erased type (i.e. List) (as Kotlin makes explicit) and deserialize it to a List<Map<String, String>>, not knowing it has to construct Ds. This is worked around by using an anonymous subclass of TypeReference in Java so that Jackson can access the full reified type to deserialize to at run time.

Translating Jackson Java code literally to Kotlin, the following thus achieves what you want (and as commented by @eski, notice that the JSON in your example is invalid):

val jacksonMapper = ObjectMapper().registerModule(KotlinModule())

val jsonStr = """[{"a": "value1", "b": 1}, {"a": "value2", "b":2}]"""
val listOfD: List<D> = jacksonMapper.readValue(jsonStr, object : TypeReference<List<D>>(){})

assertEquals(listOf(D("value1", 1), D("value2", 2)), listOfD)

This is a bit verbose and ugly though, so you could hide it in a Kotlin (extension) function (especially if you plan on using it several times):

inline fun <reified T> ObjectMapper.readValue(json: String): T = readValue(json, object : TypeReference<T>(){})

which would allow you to then just call:

val listOfD: List<D> = jacksonMapper.readValue(jsonStr)

And this is just what's included in the 2.6.3-2 jackson Kotlin module.

🌐
Google APIs
storage.googleapis.com › dnvqubsaeounre › kotlin-string-to-json-object.html
Kotlin String To Json Object at Steve Huckabee blog
March 10, 2025 - In this article, we explored how to convert strings to json objects in kotlin using jackson and gson.. Kotlin String To Json Object. ... Format String in Kotlin With Examples Spark By {Examples} Kotlin String To Json Object Best way is using kotlinx.serialization. In this tutorial, we’re gonna look at way to convert json string, json file, json url into object, array, map and do the opposite: You can also serialize object collections, such as lists, in a single call: By converting json strings into json.
🌐
Educative
educative.io › answers › parsing-api-data-in-kotlin-using-jackson
Parsing API data in Kotlin using Jackson
val body = response.body?.string() ?: "" val jsonBody = objectMapper.readValue<DTO>(body) return jsonBody · } } That’s it - we’re now able to call an external API and deserialize​ the response into a workable format. Next, we’ll learn how to save our results in a database. Jackson for Kotlin ·
🌐
Reddit
reddit.com › r/kotlin › convert json to kotlin classes.
r/Kotlin on Reddit: Convert JSON to Kotlin classes.
October 9, 2020 -

Hi all,

I have a chunk of json from here (https://world.openfoodfacts.org/api/v0/product/5010358111810.json), that I need to be able to parse.

I wrote a quick prototype in C# where I simply pasted the JSON in to Visual Studio and it converts the json into C# classes.

I realise that you can't do that in Android Studio and I tried an online json-->Kotlin class converter tool, which appeared to do the job...until I imported them into Android Studio.

It didn't like some of the names it created, so I set about changing them manually, then realised that when it comes to deserialising it, the deserializer won't know what the names are to match.

How do you all go about creating the classes for a JSON string this size?

Failing that, is it possible to convert it to a generic type and iterate around the result?

🌐
Squarepolka
library.squarepolka.com › content › stackoverflow.com_en_all_2023-11 › questions › 41928803 › how-to-parse-json-in-kotlin
How to parse JSON in Kotlin? - Stack Overflow
1 month ago - You can use JSON to Kotlin Data class converter plugin in Android Studio for JSON mapping to POJO classes (kotlin data class).
🌐
Stefanhendriks
stefanhendriks.com › 2021 › 01 › 29 › deserialise-json-to-typed-map-with-jackson-in-kotlin
Deserialise Json to typed Map with Jackson in Kotlin – Stefan Hendriks' blog
January 29, 2021 - val map = if (StringUtils.isEmpty(json)) { HashMap<MyEnum, Int>() } else { val typeRef: TypeReference<Map<MyEnum, Int>> = object : TypeReference<Map<MyEnum, Int>>() {} objectMapper.readValue(json, typeRef) }
🌐
GitHub
github.com › FasterXML › jackson-module-kotlin
GitHub - FasterXML/jackson-module-kotlin: Module that adds support for serialization/deserialization of Kotlin (http://kotlinlang.org) classes and data classes. · GitHub
Previously a default constructor must have existed on the Kotlin object for Jackson to deserialize into the object. With this module, single constructor classes can be used automatically, and those with secondary constructors or static factories are also supported. ... Releases require that you have included Kotlin stdlib and reflect libraries already. ... <dependency> <groupId>tools.jackson.module</groupId> <artifactId>jackson-module-kotlin</artifactId> <version>3.2.0</version> </dependency> For any Kotlin class or data class constructor, the JSON property names will be inferred from the parameters using Kotlin runtime type information.
🌐
BezKoder
bezkoder.com › home › kotlin – convert object to/from json string using gson
Kotlin - Convert object to/from JSON string using Gson - BezKoder
April 11, 2020 - – Kotlin – Convert Object to ... – Read JSON file from assets using Gson ... Gson is a Java/Kotlin library for converting Java/Kotlin Objects into JSON representation, also a JSON string to an equivalent Java/Kotlin ...
🌐
DEV Community
dev.to › loizenai › kotlin-convert-object-to-from-json-with-jackson-2-x-jb6
Kotlin – Convert Object to/from JSON with Jackson 2.x - DEV Community
April 12, 2021 - This tutorial shows you how to use Jackson 2.x to convert Kotlin object to/from JSON. ... Convert JSON string/JSON file/JSON url to Person(name:String,age:Int,messages:List) Kotlin Object, then convert Person object to JSON string/JSON file.