Ion (serialization format)

Ion
Filename extension .ion
Developed by Amazon
Type of format Data interchange
Website amznlabs.github.io/ion-docs/

Ion is a data serialization language developed by Amazon. It may be represented by either a human-readable text form or a compact binary form. The text form is a superset of JSON; thus, any valid JSON document is also a valid Ion document.

Data types

As a superset of JSON, Ion includes the following data types

  • null : An empty value
  • bool : Boolean values
  • string : Unicode text literals
  • list : Ordered heterogeneous collection of Ion values
  • struct : Unordered collection of key/value pairs

The nebulous JSON 'number' type is strictly defined in Ion to be one of

  • int : Signed integers of arbitrary size
  • float : 64-bit IEEE binary-encoded floating point numbers
  • decimal : Decimal-encoded real numbers of arbitrary precision

Ion adds these types:

  • timestamp : Date/time/timezone moments of arbitrary precision
  • symbol : Unicode symbolic atoms (aka identifiers)
  • blob : Binary data of user-defined encoding
  • clob : Text data of user-defined encoding
  • sexp : Ordered collections of values with application-defined semantics

Each Ion type supports a null variant, indicating a lack of value while maintaining a strict type (e.g., null.int , null.struct ).

The Ion format permits annotations to any value in the form of symbols. Such annotations may be used as metadata for otherwise opaque data (such as a blob).

Examples

Sample document

{
  "key": "value",
  "A float value": -31415e-4,
  "An int value": null.int
}


This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.