json-parse-helpfulerror
A drop-in replacement for JSON.parse that uses `jju` to give helpful errors
Last updated 12 years ago by smikes .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install json-parse-helpfulerror 
SYNC missed versions from official npm registry.

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

Current Tags

  • 1.0.3                                ...           latest (12 years ago)

3 Versions

  • 1.0.3                                ...           12 years ago
  • 1.0.2                                ...           12 years ago
  • 1.0.1                                ...           12 years ago
Maintainers (1)
Downloads
Total 29
Today 0
This Week 1
This Month 14
Last Day 0
Last Week 4
Last Month 14
Dependencies (0)
None
Dev Dependencies (3)

© 2010 - cnpmjs.org x YWFE | Home | YWFE