Skip to content

Latest commit

 

History

History
39 lines (29 loc) · 1.14 KB

README.md

File metadata and controls

39 lines (29 loc) · 1.14 KB

just-is-json

NPM version Travis Build Status dependencies Status devDependencies Status Greenkeeper badge

Just check if a string is a valid JSON string

Installation

npm i just-is-json

API

const isJSON = require("just-is-json");

isJSON('{"foo":"bar"}'); // true
isJSON("1"); // true
isJSON("null"); // true
isJSON("[1,2,3]"); // true
isJSON(1); // true
isJSON(null); // true
isJSON("true"); // true
isJSON(true); // true

isJSON("not-json"); // false
isJSON([1, 2, 3]); // false
isJSON({ foo: "bar" }); // false
isJSON('{"foo":"bar}'); // false