-
-
Notifications
You must be signed in to change notification settings - Fork 3
[Feature request] Use @JsonValue
annotation
#2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@JsonValue
annotation@JsonValue
annotation
@caarmen I had a quick look and the Java annotation seems to be missing on the class. Seems like this might be related to that dotty issue you linked to FasterXML/jackson-module-scala#532 |
@caarmen I added scala/scala3#12492 (comment) - but while that issue is similar to this, I think it is different. That issue relates to the In this case, there is an annotation on the enum class and Scala 3 seems to ignore it regardless of the |
actually, I think the existing dotty issue might fix this issue - but you will need
instead of just The core jackson-databind does not seem to support |
If you use |
Currently, the EnumSerializerModule serializes enums by using their
toString
:It would be nice to look for a field with a
@JsonValue
annotation, and use that instead oftoString()
, if it exists.Example use case:
I'd like to see
noun
instead ofNOUN
in the json.For now, my workaround is to override
toString
:This workaround seems to work just fine. I thought it might be a nice bonus to be able to use the
@JsonValue
annotation though.The text was updated successfully, but these errors were encountered: