ion-convert
The Ion data format is a richly-typed, self-describing, hierarchical data serialization format. It has both a text version which is a superset of JSON and a compact binary version.
ion-convert
converts various data formats to and from the Ion format.
It reads the input according to the given source type and outputs the target type. For example:
echo '{"name": "Jeff"}' | ion-convert --source-type json --target-type ion-text
{
name:"Jeff"
}
Short argument flags are available as well:
echo '{"name": "Jeff"}' | ion-convert -s json -t ion-text
ion-convert reads from stdin and writes to stdout by default. Alternatively, you can specify input and output files as arguments:
ion-convert input.json --source-type json --target-type ion-text --output-file output.ion
Installation
Install using npm:
npm install -g ion-convert
Verify ion-convert
is installed:
ion-convert --help
Cookbook
Convert a JSON file into Ion text
ion-convert input.json -s json -t ion-pretty -o output.iontext
See the content of an Ion binary file
ion-convert -s ion-binary -t ion-pretty < input.ion
Source Types
ion-binary Ion binary format
ion-text Ion text format
json Formatted according to RFC 7159
json-lines Each line is a separate JSON object
Target Types
ion-binary Ion binary format
ion-pretty Ion text that's easy to read
ion-text Ion text with superfluous whitespace removed
Support for additional Source and Target Types
If you want support for an additional source or target type please create an issue.