1.0.0 • Published 6 years ago
just-is-json v1.0.0
just-is-json
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
Changelog
License
1.0.0
6 years ago