Licence
ISC
Version
1.0.2
Deps
5
Size
46 kB
Vulns
0
Weekly
0
json-lint
Derived from jslint-mod by Zach Carter and Andrey Gubanov
A JSON parser and validator
- Confirms valid JSON format
- Discards invalid whitespace chars
- Errors on duplicate object keys
Installation
Soon to be hopefully published as json-lint
npm install json-linter-2
Usage
CLI
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
Programmatical
const jsonLint = require("json-linter-2");
const jsonObject = jsonLint(jsonString); // Throws if JSON is invalid
Tests
npm test