Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jackson 2.0 compatibility with Jackson 1.x annotations?

I have an older framework class that is annotated with jackson 1.x. My application uses jackson 2.0 to handle json serialization. Is it possible to configure jackson 2.0 to understand the "old" annotations? currently these annotations are simply ignored.

like image 867
Laures Avatar asked Sep 17 '12 14:09

Laures


1 Answers

There is no out-of-the-box configuration, but it should be quite easy to implement Jackson 2.0 AnnotationIntrospector (possibly extending JacksonAnnotationIntrospector) and make it use Jackson 1.x annotations in addition to or instead of 2.x annotations.

In fact, you could basically just take 1.x JacksonAnnotationIntrospector and replace its usage.

The reason 2.0 does not and will not support 1.x annotations directly is that it would pull in additional dependencies, and probably cause version conflicts. But that does not prevent external libraries from doing this -- in fact, if anyone wanted to contribute, I am sure Jackson project would accept "Jackson 1.x annotations" module for github.

like image 127
StaxMan Avatar answered Dec 04 '22 08:12

StaxMan