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.

Global custom serializers

See original GitHub issue

What is your use-case and why do you need this feature?

If you have a data class with many “unsupported” types, but very common types in the JDK it is unweidly to use @ContextualSerialization everywhere - either on a file basic or a property basis.

For example,

data class Foo(val decimal: BigDecimal, val id: UUID, val date: LocalDateTime)

Three types, needing three @ContextualSerialization.

Describe the solution you’d like

Some way of registering global serializers.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:22
  • Comments:20 (12 by maintainers)

github_iconTop GitHub Comments

6reactions
angryzibercommented, Sep 13, 2022

@sandwwraith just a reminder that kolinx-serialization without this feature is unusable for a lot of developers on the JVM

3reactions
marco-ecksteincommented, Feb 7, 2021

Not global, but the file-level annotation @file:UseSerializers(MySerializer::class) mitigates the problem. See Specifying serializers for a file.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Global Serializer
A custom serializer should be registered for a specific class type. The global serializer handles all class types if all the steps in...
Read more >
Jackson - Custom Serializer | Baeldung
This quick tutorial will show how to serialize a Java entity with Jackson 2 using a Custom Serializer. If you want to dig...
Read more >
How do I use a custom Serializer with Jackson? - Stack Overflow
You can put @JsonSerialize(using = CustomDateSerializer.class) over any date field of object to be serialized.
Read more >
Global custom serializers - - Bountysource
Global custom serializers. Kotlin. 04 July 2019 Posted by sksamuel. What is your use-case and why do you need this feature?
Read more >
How to write custom converters for JSON serialization - .NET
There are two patterns for creating a custom converter: the basic pattern and the factory pattern. The factory pattern is for converters that ......
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