1.0.2 • Published 5 years ago

json-linter-2 v1.0.2

Weekly downloads
28
License
ISC
Repository
github
Last release
5 years ago

*nix build status Windows build status npm version

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