Skip to content

itgalaxy/just-is-json

Repository files navigation

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

About

Just check if a string is a valid JSON string.

Resources

License

Stars

Watchers

Forks

Packages

No packages published