Misplaced Pages

Ion (serialization format)

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.
For other uses, see Ion (disambiguation).
This article has multiple issues. Please help improve it or discuss these issues on the talk page. (Learn how and when to remove these messages)
The topic of this article may not meet Misplaced Pages's general notability guideline. Please help to demonstrate the notability of the topic by citing reliable secondary sources that are independent of the topic and provide significant coverage of it beyond a mere trivial mention. If notability cannot be shown, the article is likely to be merged, redirected, or deleted.
Find sources: "Ion" serialization format – news · newspapers · books · scholar · JSTOR (July 2017) (Learn how and when to remove this message)
This article's use of external links may not follow Misplaced Pages's policies or guidelines. Please improve this article by removing excessive or inappropriate external links, and converting useful links where appropriate into footnote references. (August 2024) (Learn how and when to remove this message)
(Learn how and when to remove this message)
Ion
Filename extension .ion
Internet media typeapplication/ion
Developed byAmazon
Type of formatData interchange
Websiteamzn.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/time zone 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).

Implementations

Examples

Sample document

// comments are allowed in Ion files using the double forward slash 
{
  key: "value",   // key here is a symbol, it can also be a string as in JSON
  nums: 1_000_000, // equivalent to 1000000, use of underscores with numbers is more readable
  'A float value': 31415e-4,  // key is a value that contains spaces 
  "An int value": .int,
  annotated: age::35,     // age here is the annotation to number 35
  lists : 'hw grades'::, // any symbol can be used as an annotation 
  many_annot: I::have::many::annotations::true, // annotations are not nested, but rather, a list of annotations
  sexp: (this (is a  "Ion") last::value 42) // Ion S-expressions, 
  _value: {{OiBTIKUgTyAASb8=}},
  _value: {{"a b"}}
}

Uses

  • Amazon's Quantum Ledger Database (QLDB) stores data in Ion documents.
  • PartiQL, an open source SQL-based query language also by Amazon, is built upon Ion. PartiQL supported queries are used by QLDB, S3Select.

Tooling and extensions

References

  1. "We are the Amazon Managed Blockchain and Amazon QLDB Teams – Ask the AWS Experts – November 29 @ 3PM PST / 6PM EST". 28 November 2018.
  2. "Announcing PartiQL: One query language for all your data". August 2019.

External links

Data exchange formats
Human readable
Binary
Comparison of data-serialization formats
Categories: