WIPIVERSE All articles

Smile (data interchange format)

Smile is a computer data interchange format based on JSON. It can be considered a binary serialization of the generic JSON data model, meaning that tools which operate on JSON can generally be used with Smile as well, provided a suitable encoder or decoder exists. The name derives from the first two bytes of its four-byte header, which consist of the "smiley" characters :) followed by a linefeed—a design choice intended to make Smile-encoded data files recognizable using textual command-line tools.

Format details

  • Filename extension: .sml
  • Internet media type: application/x-jackson-smile (proposed)
  • Magic number: 3a 29 0a (i.e., ":) ")
  • Extended from: JSON
  • Standard: No RFC as of yet
  • Specification repository: FasterXML/smile-format-specification (GitHub)

History

Smile was specified in 2010 by the Jackson JSON processor development team. The first compliant implementation was included as a Jackson backend in Jackson version 1.6, released in September 2010.

Efficiency

Compared to JSON, Smile is both more compact and more efficient to process, both when reading and writing. Part of this efficiency comes from its binary encoding, which is similar in approach to other binary formats such as BSON, CBOR, and UBJSON. An additional distinguishing feature is the optional use of back references for property names and values: back referencing allows property names and short string values (64 bytes or less) to be replaced with one- or two-byte reference IDs, further reducing data size.

Implementations

Libraries known to support Smile include:

  • Cheshire (Clojure) — a data encoding library that supports Smile as a binary alternative to JSON
  • Jackson (Java) — via its binary dataformat module supporting Smile, Avro, CBOR, Ion, and Protocol Buffers
  • libsmile (C/C++, with wrappers for Ruby and Perl)
  • smile_ex (Erlang, Elixir, and Gleam)
  • go-smile (Golang) — for decoding Smile data
  • Protostuff (Java) — supports Smile, JSON, XML, and Protocol Buffers
  • PySmile and NewSmile (Python) — for encoding/decoding Smile data
  • smile-js (JavaScript) — for decoding Smile data
  • serde_smile (Rust) — for encoding/decoding Smile data

Usage

Elasticsearch supports Smile in its application programming interfaces (APIs), using the format for data interchange with its clients and tooling.

Browse

More topics to explore

    Browse all articles