json-parse-async

The missing JSON.parse async interface.


Keywords
JSON, parse, async, promise
License
MIT
Install
npm install json-parse-async@1.0.3

Documentation

json-parse-async

Last version Build Status Dependency status Dev Dependencies Status NPM Status Donate

The missing JSON.parse async interface.

Install

npm install json-parse-async --save

If you want to use in the browser (powered by Browserify):

bower install json-parse-async --save

and later link in your HTML:

<script src="bower_components/json-parse-async/dist/json-parse-async.js"></script>

Usage

var parseJSON = require('json-parse-async');
var stringify = '{"foo":"bar"}';

// as callback interface
parseJSON(stringify, function(err, content) {
  console.log(content.foo); //  => 'bar'
});

// as promise interface
parseJSON(stringify)
  .then(function(content) {
    console.log(content.foo); // => 'bar'
  })
  .catch(function(err) {
    console.log('promise was rejected:', err);
  });

License

MIT © Kiko Beats