1*944f89f8SAndroid Build Coastguard Worker# Overview 2*944f89f8SAndroid Build Coastguard Worker 3*944f89f8SAndroid Build Coastguard WorkerThis project contains core low-level incremental ("streaming") parser and generator abstractions used by 4*944f89f8SAndroid Build Coastguard Worker[Jackson Data Processor](http://wiki.fasterxml.com/JacksonHome). 5*944f89f8SAndroid Build Coastguard WorkerIt also includes the default implementation of handler types (parser, generator) that handle JSON format. 6*944f89f8SAndroid Build Coastguard WorkerThe core abstractions are not JSON specific, although naming does contain 'JSON' in many places, due to historical reasons. Only packages that specifically contain word 'json' are JSON-specific. 7*944f89f8SAndroid Build Coastguard Worker 8*944f89f8SAndroid Build Coastguard WorkerThis package is the base on which [Jackson data-binding](https://github.com/FasterXML/jackson-databind) package builds on. 9*944f89f8SAndroid Build Coastguard WorkerIt is licensed under [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0). 10*944f89f8SAndroid Build Coastguard WorkerFor additional/alternative licensing questions, please contact `[email protected]`: affordable commercial licenses available for use cases like Android app development. 11*944f89f8SAndroid Build Coastguard Worker 12*944f89f8SAndroid Build Coastguard WorkerAlternate data format implementations (like 13*944f89f8SAndroid Build Coastguard Worker[Smile (binary JSON)](https://github.com/FasterXML/jackson-dataformat-smile), 14*944f89f8SAndroid Build Coastguard Worker[XML](https://github.com/FasterXML/jackson-dataformat-xml), 15*944f89f8SAndroid Build Coastguard Worker[CSV](https://github.com/FasterXML/jackson-dataformat-csv)) 16*944f89f8SAndroid Build Coastguard Workerand [CBOR](https://github.com/FasterXML/jackson-dataformat-cbor) 17*944f89f8SAndroid Build Coastguard Workeralso build on this base package, implementing the core interfaces, 18*944f89f8SAndroid Build Coastguard Workermaking it possible to use standard [data-binding package](https://github.com/FasterXML/jackson-databind) regardless of underlying data format. 19*944f89f8SAndroid Build Coastguard Worker 20*944f89f8SAndroid Build Coastguard WorkerProject contains versions 2.0 and above: source code for earlier (1.x) versions is available from [Codehaus](http://jackson.codehaus.org) SVN repository. 21*944f89f8SAndroid Build Coastguard Worker 22*944f89f8SAndroid Build Coastguard Worker[](https://travis-ci.org/FasterXML/jackson-core) [](https://maven-badges.herokuapp.com/maven-central/com.fasterxml.jackson.core/jackson-core) 23*944f89f8SAndroid Build Coastguard Worker[](http://www.javadoc.io/doc/com.fasterxml.jackson.core/jackson-core) 24*944f89f8SAndroid Build Coastguard Worker[](https://coveralls.io/github/FasterXML/jackson-core?branch=master) 25*944f89f8SAndroid Build Coastguard Worker 26*944f89f8SAndroid Build Coastguard Worker# Get it! 27*944f89f8SAndroid Build Coastguard Worker 28*944f89f8SAndroid Build Coastguard Worker## Maven 29*944f89f8SAndroid Build Coastguard Worker 30*944f89f8SAndroid Build Coastguard WorkerFunctionality of this package is contained in 31*944f89f8SAndroid Build Coastguard WorkerJava package `com.fasterxml.jackson.core`. 32*944f89f8SAndroid Build Coastguard Worker 33*944f89f8SAndroid Build Coastguard WorkerTo use the package, you need to use following Maven dependency: 34*944f89f8SAndroid Build Coastguard Worker 35*944f89f8SAndroid Build Coastguard Worker```xml 36*944f89f8SAndroid Build Coastguard Worker<dependency> 37*944f89f8SAndroid Build Coastguard Worker <groupId>com.fasterxml.jackson.core</groupId> 38*944f89f8SAndroid Build Coastguard Worker <artifactId>jackson-core</artifactId> 39*944f89f8SAndroid Build Coastguard Worker <version>${jackson-core-version}</version> 40*944f89f8SAndroid Build Coastguard Worker</dependency> 41*944f89f8SAndroid Build Coastguard Worker``` 42*944f89f8SAndroid Build Coastguard Worker 43*944f89f8SAndroid Build Coastguard Workeror download jars from Maven repository or links on [Wiki](../../wiki). 44*944f89f8SAndroid Build Coastguard WorkerCore jar is a functional OSGi bundle, with proper import/export declarations. 45*944f89f8SAndroid Build Coastguard Worker 46*944f89f8SAndroid Build Coastguard WorkerPackage has no external dependencies, except for testing (which uses `JUnit`). 47*944f89f8SAndroid Build Coastguard Worker 48*944f89f8SAndroid Build Coastguard Worker## Non-Maven 49*944f89f8SAndroid Build Coastguard Worker 50*944f89f8SAndroid Build Coastguard WorkerFor non-Maven use cases, you download jars from [Central Maven repository](http://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-core/) or [Wiki](../../wiki). 51*944f89f8SAndroid Build Coastguard Worker 52*944f89f8SAndroid Build Coastguard WorkerCore jar is also a functional OSGi bundle, with proper import/export declarations, so it can be use on OSGi container as is. 53*944f89f8SAndroid Build Coastguard Worker 54*944f89f8SAndroid Build Coastguard Worker----- 55*944f89f8SAndroid Build Coastguard Worker# Use it! 56*944f89f8SAndroid Build Coastguard Worker 57*944f89f8SAndroid Build Coastguard Worker## General 58*944f89f8SAndroid Build Coastguard Worker 59*944f89f8SAndroid Build Coastguard WorkerUsage typically starts with creation of a reusable (and thread-safe, once configured) `JsonFactory` instance: 60*944f89f8SAndroid Build Coastguard Worker 61*944f89f8SAndroid Build Coastguard Worker```java 62*944f89f8SAndroid Build Coastguard WorkerJsonFactory factory = new JsonFactory(); 63*944f89f8SAndroid Build Coastguard Worker// configure, if necessary: 64*944f89f8SAndroid Build Coastguard Workerfactory.enable(JsonParser.Feature.ALLOW_COMMENTS); 65*944f89f8SAndroid Build Coastguard Worker``` 66*944f89f8SAndroid Build Coastguard Worker 67*944f89f8SAndroid Build Coastguard WorkerAlternatively, you have a `ObjectMapper` (from [Jackson Databind package](https://github.com/FasterXML/jackson-databind)) handy; if so, you can do: 68*944f89f8SAndroid Build Coastguard Worker 69*944f89f8SAndroid Build Coastguard Worker```java 70*944f89f8SAndroid Build Coastguard WorkerJsonFactory factory = objectMapper.getFactory(); 71*944f89f8SAndroid Build Coastguard Worker``` 72*944f89f8SAndroid Build Coastguard Worker 73*944f89f8SAndroid Build Coastguard Worker## Usage, simple reading 74*944f89f8SAndroid Build Coastguard Worker 75*944f89f8SAndroid Build Coastguard WorkerAll reading is by using `JsonParser` (or its sub-classes, in case of data formats other than JSON), 76*944f89f8SAndroid Build Coastguard Workerinstance of which is constructed by `JsonFactory`. 77*944f89f8SAndroid Build Coastguard Worker 78*944f89f8SAndroid Build Coastguard WorkerAn example can be found from [Reading and Writing Event Streams](http://www.cowtowncoder.com/blog/archives/2009/01/entry_132.html) 79*944f89f8SAndroid Build Coastguard Worker 80*944f89f8SAndroid Build Coastguard Worker## Usage, simple writing 81*944f89f8SAndroid Build Coastguard Worker 82*944f89f8SAndroid Build Coastguard WorkerAll writing is by using `JsonGenerator` (or its sub-classes, in case of data formats other than JSON), 83*944f89f8SAndroid Build Coastguard Workerinstance of which is constructed by `JsonFactory`: 84*944f89f8SAndroid Build Coastguard Worker 85*944f89f8SAndroid Build Coastguard WorkerAn example can be found from [Reading and Writing Event Streams](http://www.cowtowncoder.com/blog/archives/2009/01/entry_132.html) 86*944f89f8SAndroid Build Coastguard Worker 87*944f89f8SAndroid Build Coastguard Worker----- 88*944f89f8SAndroid Build Coastguard Worker 89*944f89f8SAndroid Build Coastguard Worker# Further reading 90*944f89f8SAndroid Build Coastguard Worker 91*944f89f8SAndroid Build Coastguard Worker## Differences from Jackson 1.x 92*944f89f8SAndroid Build Coastguard Worker 93*944f89f8SAndroid Build Coastguard WorkerProject contains versions 2.0 and above: source code for earlier (1.x) versions is available from [Codehaus](http://jackson.codehaus.org) SVN repository 94*944f89f8SAndroid Build Coastguard Worker 95*944f89f8SAndroid Build Coastguard WorkerNote that the main differences compared to 1.0 core jar are: 96*944f89f8SAndroid Build Coastguard Worker 97*944f89f8SAndroid Build Coastguard Worker* Maven build instead of Ant 98*944f89f8SAndroid Build Coastguard Worker* Annotations carved out to a separate package (that this package depends on) 99*944f89f8SAndroid Build Coastguard Worker* Java package is now `com.fasterxml.jackson.core` (instead of `org.codehaus.jackson`) 100*944f89f8SAndroid Build Coastguard Worker 101*944f89f8SAndroid Build Coastguard Worker## Links 102*944f89f8SAndroid Build Coastguard Worker 103*944f89f8SAndroid Build Coastguard Worker* Project [Wiki](../../wiki) has JavaDocs and links to downloadable artifacts 104*944f89f8SAndroid Build Coastguard Worker* [Jackson Github Hub](https://github.com/FasterXML/jackson) has links to all official Jackson components 105*944f89f8SAndroid Build Coastguard Worker* [Jackson Github Doc](https://github.com/FasterXML/jackson-docs) is the hub for official Jackson documentation 106*944f89f8SAndroid Build Coastguard Worker 107