This tool can be used to check whether .json files are valid or not. You can verify a single file or a folder consisting of JSON files. (Any improvements or suggestions are welcome! Please raise an issue with detailed desription and requirements)
npm install -g json-verifier
json-verifier
, you will get the options on how to use the tool as below. Options:
-V, --version output the package version number
-f, --file <file_path> verify the JSON file for the file path given
-flr, --folder <folder_path> verify all the JSON files and parse them for the folder path given
-d, --max-depth <number> set the max depth for the JSON file(s) you want to check
-l --logging <Y/N> Choose if you want to log the results of the verification. By default it is enabled.
-h, --help display help for available options
(WORK IN PROGRESS)For using the package in your code to check for JSON objects validity and parse it
import jsonParser from 'json-verifier-cli';
const obj = {"key":"value", "list":true}; //have to stringify before sending it as an input
console.log(jsonParser(JSON.stringify(obj))); //outputs: {"key":"value", "list":true}, as it is valid
npm install
npm test
directories
array in index.test.js
file if deleting/adding any new folder.