1.0.0 • Published 6 years ago

just-is-json v1.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

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

Changelog

License