Jackson Glossary: ObjectMapper
Package: org.codehaus.jackson.map
Jar: jackson-mapper
Role
This is the central factory object for data binding functionality and is usually the first object application code creates and interacts with.
Instances are fully thread-safe when "configure-then-use" pattern is used (i.e. configuration is not thread-safe but usage is). And when using ObjectWriter and ObjectReader instances even configuration is thread safe.
Usage
1 ObjectMapper mapper = new ObjectMapper();
2 mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
3 String json = mapper.writeValueAsString(new MyBean());
Known sub-classes
XmlMapper can be used to read/write POJOs as xml.
Back to Jackson Term Glossary
