Skip to content

shubhamoli/is-valid-json

Repository files navigation

is-valid-json


A small tool to check if a Javscript literal/object is JSON or not

Installation (as node package)

npm install is-valid-json --save

Version

1.0.2

License

MIT

Usage

var isJSON = require('is-valid-json');

// "obj" can be {},{"foo":"bar"},2,"2",true,false,null,undefined, etc.
var obj = "any JS literal here";   

if( isJSON(obj) ){

  // Valid JSON, do something
}
else{

  // not a valid JSON, show friendly error message
}

About

With NPM Downloads > 100,000 - A small tool to check if a Javscript literal/object is JSON or not

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •