FasterXML/jackson

Jackson Project Home @github
This is the home page of the Jackson Project, formerly known as the standard JSON library for Java (or JVM platform in general), or, as the “best JSON parser for Java.” Or simply as “JSON for Java.” More than that, Jackson is a suite of data-processing tools for Java (and the JVM platform), including the flagship streaming JSON parser / generator library, matching data-binding library (POJOs to and from JSON) and additional data format modules to process data encoded in Avro, BSON, CBOR, CSV, Smile, (Java) Properties, Protobuf, XML or YAML; and even the large set of data format modules to support data types of widely used data types such as Guava, Joda, PCollections and many, many more (see below).

While the actual core components live under their own projects – including the three core packages (streaming, databind, annotations); data format libraries; data type libraries; JAX-RS provider; and a miscellaneous set of other extension modules – this project act as the central hub for linking all the pieces together.

A good companion to this README is the Jackson Project FAQ.

On reporting issues
First things first: unless you know what you are doing, DO NOT FILE ISSUES ON THE ISSUE TRACKER OF THIS REPO.

Instead, do one of the following:

For Jackson usage questions (for core components or modules), please use the Jackson-user Google group
or, StackOverflow, #jackson
For reporting issues on Jackson implementation, report it against one of the components
The most common issue you will have is with Jackson databind
For suggestions and new ideas, try Jackson Future Ideas
Actively developed versions
Jackson suite has two major versions: 1.x is deprecated and no versions are released; 2.x is the actively developed version. These two major versions use different Java packages and Maven artifact ids, so they are not mutually compatible, but can peacefully co-exist: a project can depend on both Jackson 1.x and 2.x, without conflicts. This is by design and was chosen as the strategy to allow smoother migration from 1.x to 2.x.

The latest stable versions from these branches are:

2.11.2, released on 02-Aug-2020
1.9.13, released 14-Jul-2013
Recommended way to use Jackson is through Maven repositories; releases are made to Central Maven Repository (CMR). Individual projects’ wiki pages sometimes also contain direct download links, pointing to CMR.

Release notes for 2.x releases are found from Jackson Releases page.

Active developed Jackson 2.x branches
Currently Jackson 2.x repositories have following actively developed branches:

2.12: next minor version being developed (as of May 2020)
2.11: current stable, actively maintained branch from which patch releases are still made
2.10: previous stable branch, patch releases still made
2.9: non-active branch from which micro-patch releases (like 2.9.10.5) MAY be made for individual components (jackson-databind usually)
master: next major version, 3.0. Still changing rapidly
Other 2.x branches exist but no full releases are planned. Micro-patches still possible for critical security issues.

Active Jackson projects
Most projects listed below are lead by Jackson development team; but some by other at-large Jackson community members. We try to keep versioning of modules compatible to reduce confusion regarding which versions work together.

Core modules
Core modules are the foundation on which extensions (modules) build upon. There are 3 such modules currently (as of Jackson 2.x):

Streaming (docs) (“jackson-core”) defines low-level streaming API, and includes JSON-specific implementations
Annotations (docs) (“jackson-annotations”) contains standard Jackson annotations
Databind (docs) (“jackson-databind”) implements data-binding (and object serialization) support on streaming package; it depends both on streaming and annotations packages
Third-party datatype modules
These extensions are plug-in Jackson Modules (registered with ObjectMapper.registerModule()), and add support for datatypes of various commonly used Java libraries, by adding serializers and deserializers so that Jackson databind package (ObjectMapper / ObjectReader / ObjectWriter) can read and write these types.

Datatype modules directly maintained by Jackson team are under the following Github repositories:

Standard Collections datatype modules:
jackson-datatype-eclipse-collections: support for Eclipse Collections (NEW in Jackson 2.10!)
jackson-datatype-guava: support for many of Guava datatypes
jackson-datatype-hppc: support for High-Performance Primitive Containers containers
jackson-datatype-pcollections: support for PCollections datatypes (since Jackson 2.7)
Hibernate: support for Hibernate features (lazy-loading, proxies)
Java 8 Modules: support or JDK 8 features and datatypes through 3 separate modules
jackson-module-parameter-names: Module that adds support for using a new JDK8 feature, ability to access names of constructor and method parameters, to allow omitting @JsonProperty.
jackson-datatype-jsr310: support for “Java 8 Dates” (ones added in JDK 8)
Also, for pre-Java8 users can use one of alternate pre-Java8 backports:
joschi/jackson-datatype-threetenbp
lldata/jackson-datatype-threetenbp
jackson-datatype-jdk8: support for JDK 8 data types other than date/time types, including Optional
Joda datatypes:
jackson-datatype-joda: support for types of Joda-Time date/time library datatypes
jackson-datatype-joda-money: support types of Joda-Money datatypes (Money, CurrencyUnit)
jackson-datatype-jsr353: support for JSON-P (“Java JSON API”) types (specifically its tree model objects)
jackson-datatype-json-org: support for org.json library types like JSONObject, JSONArray
In addition, we are aware of additional modules that are not directly maintained by core Jackson team:

jackson-datatype-bolts support for reading/writing types defined by Yandex Bolts collection types (Functional Programming inspired immutable collections)
jackson-datatype-commons-lang3 for types of Apache Commons Lang v3
jackson-datatype-money for “Java Money”, see javax.money
javaslang-jackson for Javaslang support (Feature-rich & self-contained functional programming in Java™ 8 and above)
jackson-datatype-json-lib for supporting types defined by “net.sf.json” library (aka “json-lib”)
jackson-datatype-jts (JTS Geometry) for GeoJSON support
jackson-lombok for better support of Lombok classes
jackson-datatype-mongo for MongoDB types
NOTE: there are a few alternatives to handling MongoDB datatypes
jackson-module-objectify for datatypes of Objectify
jackson-datatype-protobuf for handling datatypes defined by the standard Java protobuf library, developed by HubSpot
NOTE! This is different from jackson-dataformat-protobuf which adds support for encoding/decoding protobuf content but which does NOT depend on standard Java protobuf library
TinyTypes includes Jackson module (group id com.github.caligin.tinytypes, artifact tinytypes-jackson)
jackson-datatype-vertx for reading/writing Vert.x org.vertx.java.core.json.JsonObject objects (repackaged org.json node types)
Providers for JAX-RS
Jackson JAX-RS Providers has handlers to add dataformat support for JAX-RS implementations (like Jersey, RESTeasy, CXF). Providers implement MessageBodyReader and MessageBodyWriter. Supported formats currently include JSON, Smile, XML, YAML and CBOR.

Data format modules
Data format modules offer support for data formats other than JSON. Most of them simply implement streaming API abstractions, so that databinding component can be used as is; some offer (and few require) additional databind level functionality for handling things like schemas.

Currently following data format modules are fully usable and supported (version number in parenthesis, if included, is the first Jackson 2.x version to include module; if missing, included from 2.0)

Avro: supports Avro data format, with streaming implementation plus additional databind-level support for Avro Schemas
CBOR: supports CBOR data format (a binary JSON variant).
CSV: supports Comma-separated values format – streaming api, with optional convenience databind additions
Ion (NEW with Jackson 2.9!): support for Amazon Ion binary data format (similar to CBOR, Smile, i.e. binary JSON - like)
(Java) Properties (2.8): creating nested structure out of implied notation (dotted by default, configurable), flattening similarly on serialization
Protobuf (2.6): supported similar to Avro
Smile: supports Smile (binary JSON) – 100% API/logical model compatible via streaming API, no changes for databind
XML: supports XML; provides both streaming and databind implementations. Similar to JAXB’ “code-first” mode (no support for “XML Schema first”, but can use JAXB beans)
YAML: supports YAML, which being similar to JSON is fully supported with simple streaming implementation
There are also other data format modules, provided by developers outside Jackson core team:

BEncode: support for reading/writing BEncode (BitTorrent format) encoded data
bson4jackson: adds support for BSON data format (by Mongo project).
Implemented as full streaming implementation, which allows full access (streaming, data-binding, tree-model)
Also see [MongoJack] library below; while not a dataformat module, it allows access to BSON data as well.
EXIficient supports Efficient XML Interchange
jackson-dataformat-msgpack adds support MessagePack (aka MsgPack) format
Implemented as full streaming implementation, which allows full access (streaming, data-binding, tree-model)
HOCON: experimental, partial implementation to support HOCON format – work in progress
Rison: Jackson backend to support Rison)
JVM Language modules
Kotlin to handle native types of Kotlin
Scala to handle native Scala types (including but not limited to Scala collection/map types, case classes)
Currently (April 2020) Scala 2.10, 2.11, 2.12 and 2.13 are supported (2.9 was supported up to Jackson 2.3)
Support for Schemas
Jackson annotations define intended properties and expected handling for POJOs, and in addition to Jackson itself using this for reading/writing JSON and other formats, it also allows generation of external schemas. Some of this functionality is included in above-mentioned data-format extensions; but there are also many stand-alone Schema tools, such as:

JSON Schema
Build tool plug-ins
Ant Task for JSON Schema Generation: Generate JSON Schemas from your Java classes with Apache Ant using the Jackson library and extension modules.
Stand-alone JSON Schema generators
Java JSON Schema Generator (supports json schema draft v7!)
Jackson jsonSchema Generator (Scala)
JSON Schema generator module: programmatically generate JSON Schema, based on Jackson POJO introspection, including annotations (ONLY SUPPORTS json schema v3!!!)
Code generators based on JSON Schema
jsonschema2pojo - Generate Java types from JSON or JSON Schema
JSON Schema validators
Java JSON Schema validator
Other schema languages
Ember Schema Generator: Generate schemas for Ember.js
Other modules, stable
Other fully usable modules by FasterXML team include:

Base modules:
Afterburner: speed up databinding by 30-40% with bytecode generation to replace use of Reflection for field access, method/constructor calls
Guice: extension that allows injection values from Guice injectors (and basic Guice annotations), instead of standard @JacksonInject (or in addition to)
JAXB Annotations: allow use of JAXB annotations as an alternative (in addition to or instead of) standard Jackson annotations
Mr Bean: “type materialization” – let Mr Bean generate implementation classes on-the-fly (NO source code generation), to avoid monkey code
OSGi: allows injection of values from OSGi registry, via standard Jackson @JacksonInject annotation
Paranamer: tiny extension for automatically figuring out creator (constructor, factory method) parameter names, to avoid having to specify @JsonProperty.
Jackson jr
While Jackson databind is a good choice for general-purpose data-binding, its footprint and startup overhead may be problematic in some domains, such as mobile phones; and especially for light usage (couple of reads or writes). In addition, some developers find full Jackson API overwhelming.

For all these reasons, we decided to create a much simpler, smaller library, which supports a subset of functionality, called Jackson jr. It builds on Jackson Streaming API, but does not depend on databind. As a result its size (both jar, and runtime memory usage) is considerably smaller; and its API is very compact.

Third-party non-module libraries based on Jackson
Jackson helper libraries
Jackson Ant path filter adds powerful filtering of properties to serialize, using Ant Path notation for hierarchic filtering
Support for datatypes
MongoJack supports efficient handling of BSON encoded data store in MongoDB.
Other things related to or inspired by Jackson
Pyckson is a Python library that aims for same goals as Java Jackson, such as Convention over Configuration
Rackson is a Ruby library that offers Jackson-like functionality on Ruby platform
Support
Community support
Jackson components are supported by the Jackson community through mailing lists, Gitter forum, Github issues. See Contributing for full details.

Enterprise support
In addition to free (for all) community support, enterprise support—starting with version 2.10—is available as part of the Tidelift Subscription for (most) Jackson components.

The maintainers of Jackson and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. Learn more.

Reporting security vulnerabilities
The recommended mechanism for reporting possible security vulnerabilities follows so-called “Coordinated Disclosure Plan” (see definition of DCP for general idea). The first step is to file a Tidelift security contact: Tidelift will route all reports via their system to maintainers of relevant package(s), and start the process that will evaluate concern and issue possible fixes, send update notices and so on. Note that you do not need to be a Tidelift subscriber to file a security contact.

Alternatively you may also report possible vulnerabilities to info at fasterxml dot com mailing address. Note that filing an issue to go with report is fine, but if you do that please DO NOT include details of security problem in the issue but only in email contact. This is important to give us time to provide a patch, if necessary, for the problem.

Documentation
Web sites
jackson-docs is our Github Jackson documentation hub
Wiki of this repo contains:
Jackson Releases
FAQ
Blogs
CowTalk (deprecated) – Blog with lots of Jackson-specific content. Not updated since 2013.
Cowtowncoder@medium – More recent blogging about Jackson
Tutorials
For first-time users there are many good Jackson usage tutorials, including:

Baeldung Jackson JSON Tutorial
Jenkov.com Jackson Tutorial
JournalDev Jackson Tutorial
LogicBig.com Jackson Tutorial
StudyTrails Jackson Introduction
Note on reporting Bugs
Jackson bugs need to be reported against component they affect: for this reason, issue tracker is not enabled for this project. If you are unsure which specific project issue affects, the most likely component is jackson-databind, so you would use Jackson Databind Issue Tracker.

Java JSON library comparisons
Since you probably want opinions by Java developers NOT related to Jackson project, regarding which library to use, here are links to some of existing independent comparisons:

Top 7 Open-Source JSON-binding providers (April 2014)
Be a Lazy but a Productive Android Developer, Part 3: JSON Parsing Library (April 2014)
“Can anyone recommend a good Java JSON library” (Linked-In group) (March 2013)
“Which JSON library to use on Android?” (September 2012)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值