0.3.1 • Published 6 years ago

liquid-json v0.3.1

Weekly downloads
311,702
License
Apache-2.0
Repository
github
Last release
6 years ago

liquid-json

Implementation of JSON which ignores BOM and shows more detailed error messages on parse failures.

usage

$ npm install liquid-json --save;
var LJSON = require('liquid-json');
LJSON.parse('{ "hello": "world" }');
LJSON.stringify({ hello: 'world' });

LJSON.parse accepts reviver function as second parameter and LJSON.stringify accepts standard JSON parameters. All errors raised from this module has error name as JSONError.

asynchronous flavour

var LJSON = require('liquid-json').async;

LJSON.parse('{ "hello": "world" }', function (err, obj) {
    console.log(obj); // logs the object
});
LJSON.stringify({ hello: 'world' }, function (err, text) {
    console.log(text); // logs '{"hello":"world"}'
});

attributions