# ion-js **Repository Path**: mirrors_amzn/ion-js ## Basic Information - **Project Name**: ion-js - **Description**: A JavaScript implementation of Amazon Ion. - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-08-08 - **Last Updated**: 2026-03-21 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Amazon Ion JavaScript An implementation of [Amazon Ion](https://amazon-ion.github.io/ion-docs/) for JavaScript written in TypeScript. [](https://www.npmjs.com/package/ion-js) [](https://github.com/amazon-ion/ion-js/blob/master/LICENSE) [](https://amazon-ion.github.io/ion-js/api/index.html) This package is tested with Node JS major versions **14**, **16**, and **18**. While this library should be usable within browsers that support **ES5+**, please note that it is not currently being tested in any browser environments. ## Getting Started You can use this library either as a Node.js module or inside an HTML page. ### NPM 1. Add `ion-js` to your dependencies using `npm` ``` npm install --save ion-js ``` 1. Use the library to read/write Ion data. Here is an example that reads Ion data from a JavaScript string: ```javascript let ion = require("ion-js"); // Reading let ionData = '{ greeting: "Hello", name: "Ion" }'; let value = ion.load(ionData); console.log(value.greeting + ", " + value.name + "!"); // Writing let ionText = ion.dumpText(value); console.log("Serialized Ion: " + ionText); ``` For more examples, see the [Ion DOM `README`](/src/dom/README.md). [Try it yourself](https://npm.runkit.com/ion-js). **Note:** if your package's public interface exposes part of this library, this library should be specified as a peer dependency in your package's package.json file. Otherwise, packages that depend on your package *and* this library may experience unexpected behavior, as two installations of this library (even if the same version) are not designed or tested to behave correctly. ### Web Browser You can include the Ion-js bundle (ES5 compatible) using the URLs * [ion-bundle.min.js](https://amazon-ion.github.io/ion-js/browser/scripts/ion-bundle.min.js) * [ion-bundle.js](https://amazon-ion.github.io/ion-js/browser/scripts/ion-bundle.js) These will create and initialize `window.ion` which has the same exact API as our `npm` package. Here is an example ```html
``` ### API [TypeDoc](https://typedoc.org/) generated documentation can be found at [here](https://amazon-ion.github.io/ion-js/api/). Please note that anything not documented in the the API documentation is not supported for public use and is subject to change in any version. ## Git Setup This repository contains a [git submodule](https://git-scm.com/docs/git-submodule) called `ion-tests`, which holds test data used by `ion-js`'s unit tests. The easiest way to clone the `ion-js` repository and initialize its `ion-tests` submodule is to run the following command. ``` $ git clone --recursive https://github.com/amazon-ion/ion-js.git ion-js ``` Alternatively, the submodule may be initialized independently from the clone by running the following commands. ``` $ git submodule init $ git submodule update ``` ## Development Use `npm` to setup the dependencies. In the project directory you can run the following: ``` $ npm install ``` Building the package can be done with the release script (which runs the tests). ``` $ npm run release ``` Tests can be run using npm as well ``` $ npm test ``` This package uses [Grunt](https://gruntjs.com/) for its build tasks. For convenience, you may want to install this globally: ``` $ npm -g install grunt-cli $ grunt release ``` Or you could use the locally installed Grunt: ``` $ ./node_modules/.bin/grunt release ``` ### Build Output The build above will compile the library into the `dist` directory. This directory has subdirectories of the form `