question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How can I use Kotlinx Serialization instead of Jackson?

See original GitHub issue

Firstly, congratulations for the awesome project. I started using it two days ago and it is very fast and simple.

I would like to use kotlinx.serialization instead of Jackson. How can I do it?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
tipsycommented, Jan 23, 2019

Firstly, congratulations for the awesome project. I started using it two days ago and it is very fast and simple.

Thanks!

I would like to use kotlinx.serialization instead of Jackson. How can I do it?

You can configure the JavalinJson plugin:

JavalinJson.toJsonMapper = object : ToJsonMapper {
     override fun map(obj: Any) =  { /* Your implementation here */ }
}

JavalinJson.fromJsonMapper = object : FromJsonMapper {
    override fun <T> map(json: String, targetClass: Class<T>) { /* Your implementation here */ }
}

These will then be used when calling ctx.json() or ctx.body<MyClass>().

1reaction
wellingtoncostacommented, Jan 23, 2019

Ok. Thanks for the quick response. I’ll try it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to swap Spring Boot mapper from Jackson to kotlinx ...
Just use Spring >= 5.3 and add corresponding kotlin plugin and serialization dependency. Spring switches serialization automatically.
Read more >
How can I use Kotlinx Serialization instead of Jackson? #471
I would like to use kotlinx.serialization instead of Jackson. How can I do it? You can configure the JavalinJson plugin: JavalinJson.
Read more >
Jackson, moshi or kotlinx.serialization? : r/Kotlin - Reddit
The main pros and cons are how well it fits (or doesn't) in your server stack. For example, kotlinx.serialization works very well in...
Read more >
Kotlinx serialization with Spring Boot - Kotlin Discussions
I am guessing spring-boot is just using Jackson by default. ... out how to override that and use Kotlin serialization instead of Jackson....
Read more >
Content negotiation and serialization | Ktor
To serialize/deserialize JSON data, you can choose one of the following libraries: kotlinx.serialization, Gson, or Jackson. kotlinx.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found