Ion (serialization format)
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.
Filename extension |
.ion |
---|---|
Developed by | Amazon |
Type of format | Data interchange |
Website | amzn |
Data types
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 pairs
The 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 precision
Ion 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 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": null.int,
annotated: age::45, // age here is the annotation to number 45
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,
blob_value: {{OiBTIKUgTyAASb8=}},
clob_value: {{"a b"}}
}
Tooling and Extensions
- Ion Path Extractor API aims to combine the convenience of a DOM API with the speed of a streaming API.
- IDE support
- Jackson data format module for Ion
- Apache Hive SerDe for Ion
- Ion Schema
- Ion Hash defines an algorithm for constructing a hash for any Ion value.
gollark: Yes, exactly.
gollark: (also, global prosperity is generally going up, illiteracy & extreme poverty going down, etc.)
gollark: Anyway, I find those "various people die of easily preventable deaths → capitalism bad" things unreasonable. I suspect most people don't actually *care* about random people somewhere dying, given the fact that you can quite easily donate to very effective charities for e.g. helping fix malaria under the existing system, and yet nobody does this.
gollark: There are MANY messages here. Yay for having vast amounts of free time now so I can read them all?
gollark: There is that weird thing in road networks where in certain cases adding additional roads can *worsen* traffic.
References
External links
- Ion specification
- Amazon supported language implementations
- Java API documentation
- C# implementation
This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.