safely-parse-json
v0.1.0
Published
Safely parse json
Readme
Parse JSON safely
const safe = require('safely-parse-json');
const value = '{ "one": "one" }';
const result = safe(value, options); // value parsedOptions are,
checkString: iftruewill assume error ifvalueis not string [default:true]returnError: iftruewill also return error, and result will be of from{ value, error }[default:false]nullOnError: iftruewill not return the original value on error, will return null instead [default:false]
