-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Milestone
Description
Before 2.8 the following worked for years. Now this annotation is not applied and enum is serialized as string. It would work if annotating the field. I am not sure if this is an expected change or not, could you please check?
public class Test {
@JsonFormat(shape = JsonFormat.Shape.NUMBER_INT)
enum Color {
RED,
YELLOW,
GREEN
}
static class Foo {
public final Color color;
Foo(Color color) {
this.color = color;
}
}
public static void main(String[] args) throws JsonProcessingException {
final ObjectMapper mapper = new ObjectMapper();
System.out.println(mapper.writeValueAsString(new Foo(Color.GREEN)));
}
}
Metadata
Metadata
Assignees
Labels
No labels