Introduction
Jackson is build up by the following modules:
- Streaming: "jackson-core"
- Annotations: "jackson-annotations"
- Databind: "jackson-databind" implements data-binding (and object serialization)
Maven
Jackson JSON Parser and Generator
To do JSON parsing and generation you only need one class com.fasterxml.jackson.databind.ObjectMapper.
To parse a json file.
And to generate json.
Different ObjectMapper#readValue(...) and ObjectMapper#writeValue(...)
Different parse methods:
- com.fasterxml.jackson.databind.ObjectMapper.readValue(File, Class
) - com.fasterxml.jackson.databind.ObjectMapper.readValue(URL, Class
) - com.fasterxml.jackson.databind.ObjectMapper.readValue(String, Class
) - com.fasterxml.jackson.databind.ObjectMapper.readValue(Reader, Class
) - com.fasterxml.jackson.databind.ObjectMapper.readValue(InputStream, Class
) - com.fasterxml.jackson.databind.ObjectMapper.readValue(byte[], Class
) - com.fasterxml.jackson.databind.ObjectMapper.readValue(DataInput, Class
)
Different generation methods:
- com.fasterxml.jackson.databind.ObjectMapper.writeValue(File, Object)
- com.fasterxml.jackson.databind.ObjectMapper.writeValue(OutputStream, Object)
- com.fasterxml.jackson.databind.ObjectMapper.writeValue(DataOutput, Object)
- com.fasterxml.jackson.databind.ObjectMapper.writeValue(Writer, Object)
- com.fasterxml.jackson.databind.ObjectMapper.writeValueAsString(Object)
- com.fasterxml.jackson.databind.ObjectMapper.writeValueAsBytes(Object)