Smile is a
computer
A computer is a machine that can be Computer programming, programmed to automatically Execution (computing), carry out sequences of arithmetic or logical operations (''computation''). Modern digital electronic computers can perform generic set ...
data interchange format based on
JSON
JSON (JavaScript Object Notation, pronounced or ) is an open standard file format and electronic data interchange, data interchange format that uses Human-readable medium and data, human-readable text to store and transmit data objects consi ...
. It can also be considered a binary serialization of the generic JSON data model, which means tools that operate on JSON may be used with Smile as well, as long as a proper encoder/decoder exists for the tool.
The name comes from the first 2 bytes of the 4 byte header, which consist of
Smiley
A smiley, sometimes called a smiley face, is a basic ideogram representing a Smile, smiling face. Since the 1950s, it has become part of popular culture worldwide, used either as a standalone ideogram or as a form of communication, such as em ...
":)" followed by a linefeed: a choice made to make it easier to recognize Smile-encoded data files using textual command-line tools.
Efficiency
Compared to JSON, Smile is both more compact and more efficient to process (both to read and write).
Part of this is due to more efficient binary encoding (similar to
BSON
BSON (; Binary JSON) is a computer data interchange format extending JSON. It is a binary form for representing simple or complex data structures including associative arrays (also known as name-value pairs), integer indexed arrays, and a suit ...
,
CBOR
Concise Binary Object Representation (CBOR) is a binary data serialization format loosely based on JSON authored by Carsten Bormann and Paul Hoffman. Like JSON it allows the transmission of data objects that contain attribute–value pair, name ...
and
UBJSON), but an additional feature is optional use of back references for property names and values.
Back referencing allows replacing of property names and/or short (64 bytes or less) String values with 1- or 2-byte reference ids.
Implementations
Libraries known to support Smile include:
Cheshire(Clojure) is a data encoding library that supports Smile as binary alternative to
JSON
JSON (JavaScript Object Notation, pronounced or ) is an open standard file format and electronic data interchange, data interchange format that uses Human-readable medium and data, human-readable text to store and transmit data objects consi ...
*
Jackson
Jackson may refer to:
Places Australia
* Jackson, Queensland, a town in the Maranoa Region
* Jackson North, Queensland, a locality in the Maranoa Region
* Jackson South, Queensland, a locality in the Maranoa Region
* Jackson oil field in Durham, ...
(Java) wit
Binary dataformat modulesupporting Smile,
Avro
Avro (an initialism of the founder's name) was a British aircraft manufacturer. Its designs include the Avro 504, used as a trainer in the First World War, the Avro Lancaster, one of the pre-eminent bombers of the Second World War, and the d ...
,
CBOR
Concise Binary Object Representation (CBOR) is a binary data serialization format loosely based on JSON authored by Carsten Bormann and Paul Hoffman. Like JSON it allows the transmission of data objects that contain attribute–value pair, name ...
, Ion and
Protocol Buffers
Protocol Buffers (Protobuf) is a free and open-source cross-platform data format used to serialize structured data. It is useful in developing programs that communicate with each other over a network or for storing data. The method involves an ...
libsmile(C/C++; wrappers for Ruby, Perl)
go-smilefor decoding Smile data in Golang
Protostuff(Java) supports multiple data formats for serialization, including Smile,
JSON
JSON (JavaScript Object Notation, pronounced or ) is an open standard file format and electronic data interchange, data interchange format that uses Human-readable medium and data, human-readable text to store and transmit data objects consi ...
,
XML
Extensible Markup Language (XML) is a markup language and file format for storing, transmitting, and reconstructing data. It defines a set of rules for encoding electronic document, documents in a format that is both human-readable and Machine-r ...
and
Protocol Buffers
Protocol Buffers (Protobuf) is a free and open-source cross-platform data format used to serialize structured data. It is useful in developing programs that communicate with each other over a network or for storing data. The method involves an ...
.
PySmilefor encoding/decoding Smile data in Python
NewSmilefor encoding/decoding Smile data in Python >= 3.7
smile-jsfor decoding Smile data from Javascript
serde_smilefor encoding/decoding data from Rust
Usage
*
Elasticsearch
Elasticsearch is a Search engine (computing), search engine based on Apache Lucene, a free and open-source search engine. It provides a distributed, Multitenancy, multitenant-capable full-text search engine with an HTTP web interface and schema ...
supports Smile with its APIs
See also
*
JSON
JSON (JavaScript Object Notation, pronounced or ) is an open standard file format and electronic data interchange, data interchange format that uses Human-readable medium and data, human-readable text to store and transmit data objects consi ...
*
BSON
BSON (; Binary JSON) is a computer data interchange format extending JSON. It is a binary form for representing simple or complex data structures including associative arrays (also known as name-value pairs), integer indexed arrays, and a suit ...
*
CBOR
Concise Binary Object Representation (CBOR) is a binary data serialization format loosely based on JSON authored by Carsten Bormann and Paul Hoffman. Like JSON it allows the transmission of data objects that contain attribute–value pair, name ...
*
UBJSON
*
Comparison of data serialization formats
This is a comparison of data serialization formats, various ways to convert complex objects to sequences of bits. It does not include markup languages used exclusively as document file format
A document file format is a Text file, text or bi ...
References
External links
Smile format specification
{{Data Exchange
JSON
Data serialization formats