Json Jackson Tips & Tricks: Challenge Solving Errors
Java + Json = Jackson
Jackson is the de-facto standard for serializing/deserializing java objects to/from json text.
To use it, simply add it in you maven pm.xml dependencies.
This transitively use jackson-core for the pure parser, and jackson-annotation for annotations:
You can enrich your Data Transfer Objects (your api jars) with Jackson (and JaxB) annotations, this has no impacts for users of your jar libraries, who are not obliged to use the parser + databind jar.
The usage is pretty simple, almost everything is accessible from the facade class ObjectMapper, which can be used like that:
Challenge : Fix these JsonMappingException(s)
I have written a series of JUnit tests, to show some common mistakes on Jackson.These tests almost all fails, but some other surprisingly works while they "should" not..
You will be surprised to see which Tests are OK, and which one are not, just by reading the source-code and trying to understand them.
The challenge for you is to fix these tests to make them work. The code is here JacksonTest.java