Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
JSON.parse with a try/catch
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
README.md
index.js
package.json
test.js

README.md

validJSON

Returns either a parsed {Object} or {Boolean} false.

Usage

Install from npm:

npm install validjson

Require and use:

var validjson = require('validjson');
var str = '{"ok": 2013}';
var obj = validjson(str);
if (obj) {
    console.log(obj);
}
Something went wrong with that request. Please try again.