Serialize enums to lowercase
See original GitHub issueIs your feature request related to a problem? Please describe.
Java enums are usually defined as UPPER_CASE_WITH_UNDERSCORE
. This is not a standard in endpoints, as these rather use lower_case_with_underscore
. There is already feature for ACCEPT_CASE_INSENSITIVE_ENUMS
, which helps with deserialization, the feature for serialization is however currently missing. Only option is using @JsonProperty
or toString()
serialization.
Describe the solution you’d like
I would like to have SerializationFeature.WRITE_ENUM_LOWERCASED
.
Usage example Any API endpoint.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:11
- Comments:9 (3 by maintainers)
Top Results From Across the Web
Jackson databind enum case insensitive - java - Stack Overflow
Can anyone suggest a better way to serialize and deserialize enums with proper naming convention? I don't want my enums in java to...
Read more >How To Serialize and Deserialize Enums with Jackson
In this quick tutorial, we'll learn how to control the way Java Enums are serialized and deserialized with Jackson 2.
Read more >Serializing Enum Values in Lowercase - MSDN - Microsoft
I have a few enums I'm using, and, when they get serialized, I'd like to have them be in lowercase. I found this...
Read more >Gson Custom Enum TypeAdapterFactory - Bram Yeh
In previous blog, I suggest to use LowercaseEnumTypeAdapterFactory on Gson.Builder to convert enums to lowercase string, despite the fact that they're ...
Read more >How to Serialize Enum to a String in C# - Code Maze
In C#, JSON serialization very often needs to deal with enum objects. By default, enums are serialized in their integer form.
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
Note that I solved it temporarily with custom serializer:
@cowtowncoder OK, no worries, thanks for the clarification! I can wait. 😃