Refactor serialization to use jackson databind.