Using Jackson with Smile format

Starting with Jackson 1.6 (see Project Smile), it is possible to read and write Smile encoded data, identical to how JSON encoded data is handled.

Simple usage

This is achieved simply by using SmileFactory for creating parser and generator instances instead of standard JsonFactory:

   1   ObjectMapper mapper = new ObjectMapper(new SmileFactory());
   2   // now 'mapper' will read and write Smile-encoded data instead of JSON!

and that should be the only change you need.

Configuration

SmileFactory exposes settings for fine-tuning way Smile encoding is used, by additional SmileParser and SmileGenerator features. Both are enabled/disabled either through SmileFactory.configure() method, or directly with SmileParser.enable() / SmileGenerator.enable (and related methods)

SmileParser.Feature

SmileGenerator.Feature

Enum Constant Summary


CategoryJackson

JacksonForSmile (last edited 2011-07-08 16:33:48 by TatuSaloranta)

Copyright ©2009 FasterXML, LLC