amzn/ion-js

Name: ion-js

Owner: Amazon

Description: A JavaScript implementation of Amazon Ion -- this is currently alpha software and is subject to change

Created: 2016-10-31 18:31:32.0

Updated: 2018-01-18 20:25:15.0

Pushed: 2018-01-12 01:21:31.0

Homepage:

Size: 1056

Language: TypeScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Table of Contents

About

Ion-JS is a JavaScript library for Ion – this is currently alpha software and is subject to change. The library allows for reading/writing Ion data from within JavaScript code.

For more information on Ion have a look at the Ion Specification as well as some of the other Ion language specific libraries such as

Use

You can use ion-js either as a Node.js module or inside an html page.

NPM
  1. Add ion-js to your dependencies using npm
    install --save-dev ion-js
    
  2. Use the library to read/write ion data. Here is an example that reads Ion data from a JavaScript string
    ionJs = require("ion-js")
    
    ionData = "{ hello: \"Ion\" }"; 
    ionReader = ionJs.makeReader(ionData); 
    eader.next(); 
    eader.stepIn(); 
    eader.next(); 
    hello = ionReader.fieldName(); 
    ion = ionReader.stringValue(); 
    eader.stepOut(); 
    ole.log(ion.concat(", ").concat(hello));
    
    Try it yourself.
Browser

You can include the Ion-js bundle (ES5 compatible) using the URLs

These will create and initialize window.ion which has the exact API as our npm package. Here is an example

l>
d>
eta charset="UTF-8"/>
cript src="scripts/ion-bundle.min.js"></script>

-- more HTML/JS code that can now use `window.ion` to create/write Ion -->
ad>
ml>
API

Ion JS API

Contribute

CONTRIBUTE.md

License

Apache License 2.0

Links


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.