Skip to main content

jsonvet

CI codecov CodSpeed PyPI crates.io Marketplace License: MIT OR Apache-2.0 OpenSSF Scorecard OpenSSF Best Practices DOI

A linter and formatter for JSON, I-JSON, JSONC, HuJSON (JWCC), JSON5 and JSON Lines. It finds syntax errors and duplicate keys, and tells you the exact line and column:

config.json:4:5: error[duplicate-key] duplicate key $.server.port (first at 2:5)
package.json:2:14: error[syntax] missing `,`
events.jsonl:12:1: error[syntax] blank line; JSON Lines needs a value on every line

It replaces check-json5, a Python hook, and is up to 1,916 times faster than check-json5 1.4.1 on JSON5 files, and 6-39x on JSON and JSONC (figures).

Try it in your browser: the playground checks, fixes and formats the text you paste. Nothing to install, and the text stays on your machine.

  • Six dialects, one parser. Each file is checked in the dialect its extension implies.
  • Fixes. --fix repairs what has a safe fix, such as a stray byte order mark.
  • Formatting that keeps comments. jsonvet fmt lays out JSON, JSONC, JWCC, JSON5 and JSON Lines and leaves your comments where they are.
  • JSON Schema with positions. Each schema error points at its value's line and column. Default runs stay offline; --schema-catalog opts into SchemaStore downloads.
  • Fits CI. A pre-commit or prek hook, a GitHub Action, a command or a Rust library, with text, SARIF or JSON output.

Quick start

Pre-commit or prek hook

Add this to .pre-commit-config.yaml (for pre-commit or prek):

- repo: https://github.com/simonvanlierde/jsonvet
  rev: v3.4.0
  hooks:
    - id: jsonvet
    - id: jsonvet-format

jsonvet-format rewrites files, so a commit that changes one fails and you commit again. Add args: [--fix] to jsonvet to repair what has a safe fix (Fixing). Both hooks are in the same block, but each works alone.

It checks files by name: .json, .jsonc, .json5, .jsonl, .ndjson, .geojson, .jsonld, .hujson, .jwcc, .code-workspace, .code-snippets, .webmanifest and .babelrc.

Options go in args, such as args: [--strict, package.json] to hold package.json to strict JSON. The hook installs a prebuilt binary from PyPI, so you need no Rust.

GitHub Action

- uses: simonvanlierde/jsonvet@v3

The step fails when a file has an error, and each problem shows up as an annotation on the pull request. Before it installs jsonvet from PyPI, it checks that the wheel came from this repository's release workflow. Its inputs are in the reference.

The Action only checks. To check formatting too, add a step with run: uvx jsonvet fmt --check .. To see the problems in GitHub code scanning, set sarif: jsonvet.sarif and upload that file, as in this workflow.

Command line

uvx jsonvet .                    # check every JSON-like file under a folder, no install needed
uvx jsonvet --fix .              # also fix what has a safe fix, in place
uvx jsonvet fmt .                # format the files, keeping their comments
uvx jsonvet fmt --check .        # list files that need formatting; exit 1 if any
jsonvet lsp                      # the language server, for your editor
uv tool install jsonvet          # install it (or `pipx install jsonvet`)
cargo install jsonvet-cli        # build it from source
cargo binstall jsonvet-cli       # download the binary from the GitHub release

uv provides uvx. Each GitHub release also has a binary for Linux, macOS and Windows, with checksums and an SBOM (verifying a release). A folder stands for the JSON-like files under it, skipping hidden and ignored files, and - reads standard input. The reference covers --fix, formatting covers jsonvet fmt, and editors covers jsonvet lsp in VS Code, Neovim, Helix and other editors. jsonvet --help lists every option, and the reference has the details.

Rust library

use jsonvet::{check, Config, Dialect};

let report = check("{\"a\": 1, \"a\": 2}", &Config::new(Dialect::Json));
for problem in report.problems() {
    let at = report.location(problem.offset());
    println!("{}:{}: {}[{}] {problem}", at.line, at.column, problem.severity(), problem.rule());
}

The API is on docs.rs.

Dialects

Dialect Adds to JSON Default for
json nothing (RFC 8259) none; choose it with --dialect or --strict
i-json stricter content (RFC 7493) none
jsonc // and /* */ comments .jsonc, .code-workspace, .code-snippets
jwcc comments and trailing commas (HuJSON) .hujson, .jwcc
json5 the JSON5 1.0.0 grammar .json, .json5, .geojson, .jsonld, .webmanifest, .babelrc
jsonl one JSON value per line (JSON Lines) .jsonl, .ndjson

Any other extension is checked as JSON5. .json defaults to JSON5 because most .json files that fail as JSON are config files with comments. To check a file as strict JSON, use --dialect json:package.json.

Rules

Rule Reports Default
syntax the first syntax error; checking stops there error
duplicate-key a key repeated in one object, with both positions and its path error
invalid-number a number a double cannot hold, or an integer past ±(2⁵³ − 1) error in i-json, off elsewhere
invalid-code-point a lone surrogate or a noncharacter in a string error in i-json, off elsewhere
byte-order-mark a byte order mark at the start of the file warning in json and i-json, error in jsonl
missing-final-newline a JSON Lines file that does not end with a newline warning in jsonl
mixed-line-endings a line ending that differs from the file's first one warning
unused-suppression a jsonvet-ignore comment that hides nothing warning in jsonc, jwcc and json5
unreadable a file that is missing, not a regular file, or not readable UTF-8 error, always
schema a value the file's JSON Schema rejects error, always

Change a rule's severity with --error, --warn or --ignore; syntax, unreadable and schema stay errors, whatever a setting says. In jsonc, jwcc and json5, a comment // jsonvet-ignore duplicate-key turns a rule off for the next line. Warnings fail a run only past --max-warnings N.

Configuration

To keep settings out of the command line, put them in jsonvet.toml, or in a [tool.jsonvet] table in pyproject.toml:

rules = { byte-order-mark = "ignore", missing-final-newline = "error" }

# For the files a glob matches, after `rules`; the last matching entry wins.
per-file-rules = [{ files = "legacy/*.json", duplicate-key = "ignore" }]

# Checked in order; the last matching entry wins.
dialects = [
  { files = ".vscode/*.json", dialect = "jsonc" },
  { files = "package.json", dialect = "json" },
]

# Skipped when jsonvet walks a folder; files named on the command line are still checked.
exclude = ["node_modules", "tests/fixtures/*"]

# Used by `jsonvet fmt`.
[format]
indent = 4
width = 100

[[per-file-format]]
files = "generated/*.json"
indent = 2

Each file takes the nearest config file in its folder or a parent, up to the repository root, so each package in a monorepo can have its own. Options on the command line win. The reference says where jsonvet looks and how globs match. Formatting lists the [format] settings and how .editorconfig fits in.

JSON Schema

--schema FILE checks each file against one JSON Schema, and reports each error at its value:

$ jsonvet --schema server.schema.json server.json5
server.json5:3:9: error[schema] "80" is not of type "integer" (at $.port)
server.json5:6:3: error[schema] Additional properties are not allowed ('debug' was unexpected) (at $.debug)

A config file can give files a schema, and so can a file's own $schema path:

schemas = [{ files = "config/server.json5", schema = "schemas/server.schema.json" }]
{ $schema: "../schemas/server.schema.json", port: 8080 }

Such a schema must stay inside the project. A $schema URL is skipped, and every $ref must point inside the schema file. --schema-catalog enables SchemaStore lookup by file name when no local schema applies, with downloads cached for seven days. Schema errors are always errors. The rules for schema paths and the limits are in the reference.

Coming from check-json5

Bump rev to the newest tag. The check-json5 hook id, the check-json5 command and --strict keep working through 3.x.

jsonvet gives the same pass or fail as 1.4.1, apart from a few edge cases. One change can fail a file that passed: .jsonc, .code-workspace and .code-snippets files are now checked as JSONC, and .hujson and .jwcc files as JWCC. To keep the old verdict, add --dialect json5:GLOB.

How it is tested

The tests run on Linux, macOS and Windows, with fuzzing, mutation testing and a comparison with check-json5 1.4.1. A conformance matrix runs the same files against 18 other parsers in four languages (27 runs with jsonvet's own and the duplicate-key variants), and shows where each one disagrees with the expected verdict.

Development

You need Rust and just.

git submodule update --init --quiet
cargo test --workspace

See CONTRIBUTING.md for the full check and lint suite.

More

Found a file jsonvet gets wrong? Please open an issue with the file and the command. If it crashes or hangs jsonvet, report it privately as SECURITY.md says.

To cite jsonvet, use the DOI 10.5281/zenodo.23461825 or GitHub's "Cite this repository" button.

Credits and license

I (Simon van Lierde) started this as a fork of check-json5 by Ben Mares, which is based on the pre-commit-hooks repository by Anthony Sottile and contributors, both MIT-licensed.

Licensed under either of Apache License, Version 2.0 or MIT license at your option. Ben Mares's copyright notice stays in the MIT text.

Unless you explicitly state otherwise, any contribution you intentionally submit for inclusion in jsonvet, as defined in the Apache-2.0 license, is dual licensed as above, without any additional terms or conditions.

Metadata

Release files for jsonvet 3.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jsonvet 3.4.0
File Size Uploaded Provenance Actions
jsonvet-3.4.0.tar.gz 380.4 kB With provenance Details for jsonvet-3.4.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for jsonvet 3.4.0
File Actions
jsonvet-3.4.0-py3-none-win_arm64.whl Python 3 none Windows ARM64 Details for jsonvet-3.4.0-py3-none-win_arm64.whl
jsonvet-3.4.0-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for jsonvet-3.4.0-py3-none-win_amd64.whl
jsonvet-3.4.0-py3-none-musllinux_1_2_x86_64.whl Python 3 none Linux musl 1.2+ x86-64 Details for jsonvet-3.4.0-py3-none-musllinux_1_2_x86_64.whl
jsonvet-3.4.0-py3-none-musllinux_1_2_aarch64.whl Python 3 none Linux musl 1.2+ ARM64 Details for jsonvet-3.4.0-py3-none-musllinux_1_2_aarch64.whl
jsonvet-3.4.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl Python 3 none Linux glibc 2.17+ x86-64 Details for jsonvet-3.4.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
jsonvet-3.4.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl Python 3 none Linux glibc 2.17+ ARM64 Details for jsonvet-3.4.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
jsonvet-3.4.0-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details for jsonvet-3.4.0-py3-none-macosx_11_0_arm64.whl
jsonvet-3.4.0-py3-none-macosx_10_12_x86_64.whl Python 3 none macOS 10.12+ x86-64 Details for jsonvet-3.4.0-py3-none-macosx_10_12_x86_64.whl

Total release size: 61.5 MB

Release files / jsonvet-3.4.0.tar.gz

Download URL jsonvet-3.4.0.tar.gz
Size 380.4 kB
Tags Source
SHA-256 checksum
How to use checksums
af2a5578361f1daefa04e9cfe8df1f1cd8d64ce8ddd5a38c99da92faac5f3cd7
BLAKE2b-256 checksum
How to use checksums
638060f18c26ec3ce8ba07f6949824dc08f3468beec8339a6817f5da66af00c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Release files / jsonvet-3.4.0-py3-none-win_arm64.whl

Download URL jsonvet-3.4.0-py3-none-win_arm64.whl
Size 6.9 MB
Tags Python 3 Windows ARM64
SHA-256 checksum
How to use checksums
ed1225a604c688c39abdf3e4832955028af74e1247f48ebb29558d27a3c99414
BLAKE2b-256 checksum
How to use checksums
e736258d5b7330419d7dffb78bfd3f532a88adaca97d60de2fa7a6147469c214
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Release files / jsonvet-3.4.0-py3-none-win_amd64.whl

Download URL jsonvet-3.4.0-py3-none-win_amd64.whl
Size 7.6 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
1cff18d0118f6a40d60d288fdfa90ab7e1bb406b94641e53eb0ccc325f990f64
BLAKE2b-256 checksum
How to use checksums
133bbaf00dde1248807b5779c1d09c86947e6032ba42e686f35fbf4969720d9f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Release files / jsonvet-3.4.0-py3-none-musllinux_1_2_x86_64.whl

Download URL jsonvet-3.4.0-py3-none-musllinux_1_2_x86_64.whl
Size 8.4 MB
Tags Linux musl 1.2+ x86-64 Python 3
SHA-256 checksum
How to use checksums
e565d8523f25591aa32626003450d31b28df07c2d612b8c6e2b5b9e328e631ae
BLAKE2b-256 checksum
How to use checksums
68a01ab9450dda699d9afd2615dc41099d6eb19fa461b25e5385f9c1dab398d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Release files / jsonvet-3.4.0-py3-none-musllinux_1_2_aarch64.whl

Download URL jsonvet-3.4.0-py3-none-musllinux_1_2_aarch64.whl
Size 7.6 MB
Tags Linux musl 1.2+ ARM64 Python 3
SHA-256 checksum
How to use checksums
32dc8619b2cd664ed4ad1ac0daade774e11f24b441d637348af903cb75bf2407
BLAKE2b-256 checksum
How to use checksums
8ab771bf50e43a2ef0ecfde02e5f8c9dbb0bcd7f4e469c52ca76554e3f4d15f2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Release files / jsonvet-3.4.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL jsonvet-3.4.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 8.2 MB
Tags Linux glibc 2.17+ x86-64 Python 3
SHA-256 checksum
How to use checksums
ab914962e26a5be73cc8dc98abc5056f6ddbe2bda02375f823da7a6a80d011f1
BLAKE2b-256 checksum
How to use checksums
2851bcd968b92838460df6287cebdf4237defbdfb5f9d4537a62ad5a5a199e05
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Release files / jsonvet-3.4.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL jsonvet-3.4.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 7.6 MB
Tags Linux glibc 2.17+ ARM64 Python 3
SHA-256 checksum
How to use checksums
6f99eaaff83533cc4340665387631381a762ece2fc4aaf7529ee925d4cb3a47e
BLAKE2b-256 checksum
How to use checksums
2728c8e7a1e90071f17f63a718825abf1d0229681174dcf3e278cba988384b09
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Release files / jsonvet-3.4.0-py3-none-macosx_11_0_arm64.whl

Download URL jsonvet-3.4.0-py3-none-macosx_11_0_arm64.whl
Size 7.0 MB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
6af2864d8b9635baa9343c8232e2325f9b9117f23b0f2c9b4aae65ea615cb271
BLAKE2b-256 checksum
How to use checksums
6471b62d6a6ec5fd36383364ac997445467a051539c402adefd3026d59b326d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Release files / jsonvet-3.4.0-py3-none-macosx_10_12_x86_64.whl

Download URL jsonvet-3.4.0-py3-none-macosx_10_12_x86_64.whl
Size 7.8 MB
Tags Python 3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
0d859fb0678a44d519cdd6d37b1dc8e77c15a5d183c3568c9660e665593ae82b
BLAKE2b-256 checksum
How to use checksums
2b62792789e27d85051c18e1a01298527fb13d678367fd46634503ba68899582
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Security for jsonvet 3.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 9 files in this release have been uploaded with provenance metadata.

Select from 9 files

Attestation for jsonvet-3.4.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page