Derived from jslint-mod by Zach Carter and Andrey Gubanov
- Confirms valid JSON format
- Discards invalid whitespace chars
- Errors on duplicate object keys
npm install json-linter-2
npx json-lint <path>
If <path>
points a directory all .json
files at directory and it's subdirectories (but excluding those ignored by .gitignore
rules)
are checked.
If <path>
ponts a file, then given file is linted
const jsonLint = require("json-linter-2");
const jsonObject = jsonLint(jsonString); // Throws if JSON is invalid
npm test