Global custom serializers
See original GitHub issueWhat 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:
- Created 4 years ago
- Reactions:22
- Comments:20 (12 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@sandwwraith just a reminder that kolinx-serialization without this feature is unusable for a lot of developers on the JVM
Not global, but the file-level annotation
@file:UseSerializers(MySerializer::class)
mitigates the problem. See Specifying serializers for a file.