Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

json-parse-helpfulerror

1.0.3 • Public • Published

json-parse-helpfulerror

A drop-in replacement for JSON.parse that uses https://npmjs.org/jju to provide more useful error messages in the event of a parse error.

Example

Installation

npm i -S json-parse-helpfulerror

Use

var jph = require('json-parse-helpfulerror');
 
var notJSON = "{'foo': 3}";     // keys must be double-quoted in JSON
 
JSON.parse(notJSON);            // throws unhelpful error
 
jph.parse("{'foo': 3}")         // throws more helpful error: "Unexpected token '\''..."

License

MIT

install

npm i json-parse-helpfulerror

Downloadsweekly downloads

144,870

version

1.0.3

license

MIT

repository

githubgithub

last publish

collaborators

  • avatar
  • avatar
  • avatar