Reputation: 231
In our code we have org.codehaus.jackson imports in java file. now we are moving to com.fasterxml.jackson.
What are the points are to be considered for smooth up gradation?
Upvotes: 6
Views: 13388
Reputation: 231
Following are some of the changes identified between Jackson 1.9.x and Jackson 2.9.8
org.codehaus.jackson
changed to com.fasterxml.jackson
org.codehaus.jackson.map
changed to com.fasterxml.jackson.databind
SerializationConfig.Feature
changed and split to SerializationFeature,MapperFeature
DeSerializationConfig.Feature
changed and split to DeSerializationFeature,MapperFeature
AnnotationIntrospector.Pair
changed to AnnotationIntrospectorPair
SerializationConfig.withAnnotationIntrospectro(...)
changed to SerializationConfig.with(...)
ObjectMapper.getSerilizationConfig().addMixInAnnotations(...)
changed to ObjectMapper.addMixIn(....)
JSonSerialize.include
changed to JSonInclude
ObjectMapper.readValue(JSonNode,...)
changed to ObjectMapper.readValue(ObjectMapper.treeAsTokens(JSonNode),...)
Upvotes: 12
Reputation: 552
I would like to add one more point to @Ravi's Answer.
In jackson-databind-2.9.8, java.sql.Date by default will be serialized to numeric timestamp instead of StdDateFormat. This will specifically cause an issue when expected date format is StdDateFormat.
java.sql.Date As per databind#219 java.sql.Date will finally use same "timestamp-or-String" determination as java.util.Date and java.util.Calendar. This means that with vanilla, unchanged settings, values will be serialized as numeric timestamps. Note that the default String serialization will still default to java.sql.Date.String(), and not to default formatting java.util.Date uses.
Upvotes: 1
Reputation: 879
Upgrading from jackson-1.X to jackson 2.X
change the get method names to direct names
For Example:
jackson-1.X methods: getBooleanValue(), getFields(), getElements(), getIntValue()
jackson-2.X methods: booleanValue(), fields(), elements(), and intValue()
Upvotes: 8