Loading AI tools
From Wikipedia, the free encyclopedia
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.
The topic of this article may not meet Wikipedia's general notability guideline. (July 2017) |
This article's use of external links may not follow Wikipedia's policies or guidelines. (August 2024) |
Filename extension |
.ion |
---|---|
Internet media type | application/ion |
Developed by | Amazon |
Type of format | Data interchange |
Website | amzn |
As a superset of JSON, Ion includes the following data types
null
: An empty valuebool
: Boolean valuesstring
: Unicode text literalslist
: Ordered heterogeneous collection of Ion valuesstruct
: Unordered collection of key/value pairsThe nebulous JSON 'number' type is strictly defined in Ion to be one of
int
: Signed integers of arbitrary sizefloat
: 64-bit IEEE binary-encoded floating point numbersdecimal
: Decimal-encoded real numbers of arbitrary precisionIon adds these types:
timestamp
: Date/time/time zone moments of arbitrary precisionsymbol
: Unicode symbolic atoms (aka identifiers)blob
: Binary data of user-defined encodingclob
: Text data of user-defined encodingsexp
: Ordered collections of values with application-defined semanticsEach 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).
// 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'::[80, 85, 90], // 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 [valid] "Ion") last::value 42) // Ion S-expressions,
_value: {{OiBTIKUgTyAASb8=}},
_value: {{"a b"}}
}
Seamless Wikipedia browsing. On steroids.
Every time you click a link to Wikipedia, Wiktionary or Wikiquote in your browser's search results, it will show the modern Wikiwand interface.
Wikiwand extension is a five stars, simple, with minimum permission required to keep your browsing private, safe and transparent.