Skip to content
/ ion-js Public
forked from amazon-ion/ion-js

A JavaScript implementation of Amazon Ion -- this is currently beta software and is subject to change

License

Notifications You must be signed in to change notification settings

cnxtech/ion-js

 
 

Table of Contents

About

Ion-JS is a Javascript library for Ion. 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

Master Specification Support

The current release on master branch is beta supported at this time.

Types IonText IonBinary Limitations
null yes no none
bool yes no none
int yes no underscores, binaryints, bigints
float yes no underscores
decimal yes no large fractions are slow roundtrip
timestamp yes no fractional seconds are slow on large fractions
string yes no none
symbol yes no sid0, no symboltokens
blob no no broken
clob yes no backed by string
struct yes no none
list yes no none
sexp yes no none
annotations yes no none
local symbol tables yes no none
shared symbol tables yes no user marshals symboltables into the catalog themselves
Github Issues
SymbolTokens
IVM
Numbers
Utf8/32/64
Blobs
Triplequotes
Binary

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
    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
    var ionJs = require("ion-js")
    
    var ionData = "{ hello: \"Ion\" }"; 
    var ionReader = ionJs.makeReader(ionData); 
    ionReader.next(); 
    ionReader.stepIn(); 
    ionReader.next(); 
    var hello = ionReader.fieldName(); 
    var ion = ionReader.stringValue(); 
    ionReader.stepOut(); 
    console.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

<html>
<head>
  <meta charset="UTF-8"/>
  <script src="scripts/ion-bundle.min.js"></script>

  <!-- more HTML/JS code that can now use `window.ion` to create/write Ion -->
</head>
</html>

API

Ion JS API

Contribute

CONTRIBUTE.md

License

Apache License 2.0

Links

About

A JavaScript implementation of Amazon Ion -- this is currently beta software and is subject to change

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 74.3%
  • JavaScript 25.6%
  • HTML 0.1%