try-parse-json

try-parse-json for javascript

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
try-parse-json
001.0.27 years ago8 years agoMinified + gzip package size for try-parse-json in KB

Readme

try-parse-json

JSON.parse() wrapped in a try catch. Returns any error instead of throwing.

Usage

var tryParseJSON = require('try-parse-json');

tryParseJSON('{"a": 1, "b": 2}') // {a:1, b:2}

Errors

tryParseJSON('[1, 2, 3,]').message // 'Unexpected token ]'