jsonlint-tree
raw JSON → 2.0.1 verified Fri May 01 auth: no javascript
A recursive directory JSON validator using jsonlint. Version 2.0.1 requires Node >=18.17, removes extra dependencies from v1, and outputs a summary of valid/invalid files. It differs from other JSON linters by operating recursively on directories rather than single files, providing a clear CLI output with counts. Maintained by educastellano.
Common errors
error Cannot find module 'jsonlint-tree' ↓
cause Attempting to require or import the package programmatically.
fix
Install globally or use npx; do not import it in code.
error Error: jsonlint-tree requires at least one argument ↓
cause Running the command without specifying a directory.
fix
Run: npx jsonlint-tree <directory-path>
error ENOENT: no such file or directory, scandir './nonexistent' ↓
cause Specified directory does not exist.
fix
Provide a valid directory path.
Warnings
breaking Node version requirement changed to >=18.17 in version 2.0.0 ↓
fix Upgrade Node.js to >=18.17 or use version 1.x for older Node.
deprecated Version 1.x is deprecated; upgrade to 2.x for reduced dependencies and modern Node support. ↓
fix Update to version 2.0.1 with npm install jsonlint-tree@latest
gotcha jsonlint-tree is a CLI tool only; it cannot be imported programmatically. Some users attempt to require('jsonlint-tree') and get undefined. ↓
fix Use child_process.spawn or exec to run the CLI from within Node scripts.
Install
npm install jsonlint-tree yarn add jsonlint-tree pnpm add jsonlint-tree Imports
- jsonlint-tree wrong
npm run jsonlint-treecorrectnpx jsonlint-tree <directory> - require wrong
const lint = require('jsonlint-tree')correctconst jsonlint = require('jsonlint') - import wrong
import tree from 'jsonlint-tree';correctimport jsonlint from 'jsonlint';
Quickstart
npx jsonlint-tree ./examples