vtypes-json
"json" validation for validate.js
About
The json
validator attempts to ensure that the input is a valid json.
Installation
Using npm:
$ npm i --save vtypes-json
const validate = ;const json = ; // you can then proceed to register the required validators.validatevalidatorsjson = json;
Usage
;// => undefined ;// => {attr: ["Attr must be a valid JSON string"]}
For more examples, check out the test files in this package's source folder.
Available Options
name | type | default | description |
---|---|---|---|
message | string | must be a valid JSON string |
Error message |
License
vtypes-json
is MIT licensed