Skip to content

Latest commit

 

History

History
 
 

smile

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

Overview

Maven Central Javadoc

This Jackson extension handles reading and writing of data encoded in Smile data format ("binary JSON"). It extends standard Jackson streaming API (JsonFactory, JsonParser, JsonGenerator), and as such works seamlessly with all the higher level data abstractions (data binding, tree model, and pluggable extensions).

Status

Module has been mature since Jackson 1.6, and is used widely (over 150 projects), often as a dynamically configurable alternative to textual JSON.

It also works very well for use cases like caching, especially when databinding is configured to serialize POJOs as Arrays which can further reduce size of serialized objects.

Maven dependency

To use this module on Maven-based projects, use following dependency:

<dependency>
  <groupId>com.fasterxml.jackson.dataformat</groupId>
  <artifactId>jackson-dataformat-smile</artifactId>
  <version>2.11.1</version>
</dependency>

(or whatever version is most up-to-date at the moment)

Usage

Basic usage is by using either SmileMapper instead of ObjectMapper, or for low-level handling using SmileFactory in places where you would usually use JsonFactory:

SmileMapper mapper = new SmileMapper();
// (or can construct factory, configure instance with 'SmileParser.Feature'
// and 'SmileGenerator.Feature' first)
SomeType value = ...;
byte[] smileData = mapper.writeValueAsBytes(value);
SomeType otherValue = mapper.readValue(smileData, SomeType.class);

Related