json-parse-helpfulerror
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/json-parse-helpfulerror package

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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.3
    1,069,376
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.3
    1,069,376
  • 1.0.2
    28
  • 1.0.1
    1

Package Sidebar

Install

npm i json-parse-helpfulerror

Weekly Downloads

1,069,405

Version

1.0.3

License

MIT

Last publish

Collaborators

  • smikes
  • othiym23
  • isaacs