ESLint plugin for linting JSON, JSONC, and JSON5 files using ESLint rules and custom rules. Current stable version is 3.1.2 with frequent releases (multiple releases per year). The plugin parses JSON files with a custom parser (jsonc-eslint-parser) based on acorn, and provides 50+ rules including auto-fix for style issues. Key differentiators vs alternatives: supports JSONC and JSON5 syntax (comments, trailing commas, etc.), integrates with Vue SFC custom blocks, has more rules than @eslint/json, and supports ESLint directives. Since v3.0.0, the plugin exports a `languages` object for ESLint language plugin integration. Requires Node >=20.19 and ESLint >=9.38.0.
npm install eslint-plugin-jsoncVerified import paths — ran on the pinned version, not inferred.
Configure ESLint flat config for JSON and JSON5 files using eslint-plugin-jsonc.
Use `language: 'json/json'` etc. in flat config. See documentation for migration.
Upgrade ESLint to >=9.38.0 and Node to >=20.19.
Migrate to flat config (eslint.config.js). You can use the `configs` export for predefined configs.
Set `language: 'json/json'` or appropriate language in the flat config object.
If upgrading from v2, use the `languages` export and set `language` in flat config.
Ensure the language supports comments: use `json/jsonc` or `json/json5` as appropriate.
Upgrade ESLint to >=9.38.0 and ensure the import of eslint-plugin-jsonc is correct: `import plugin from 'eslint-plugin-jsonc'` and use `plugins: { jsonc: plugin }`.Set `language: 'json/jsonc'` for files with comments.
Run `npm install eslint-plugin-jsonc --save-dev` and ensure the import is correct (e.g., `import plugin from 'eslint-plugin-jsonc'`).