Skip to main content

jsonvet

CI PyPI crates.io codecov License: MIT DOI OpenSSF Scorecard

A linter 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
  • Six dialects, one parser. Each file is checked in the dialect its extension implies.
  • JSON Schema with positions. --schema points each schema error at its value's line and column. It never fetches anything from the network.
  • Fits CI. Use it as a pre-commit or prek hook, a GitHub Action, a command or a Rust library. It writes text, SARIF for GitHub code scanning, or JSON for scripts and editors.
  • Fast. It was check-json5, a Python hook, until 2.0 rewrote it in Rust. It is up to 1,407 times faster than check-json5 1.4.1 (figures).

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.1.1
  hooks:
    - id: jsonvet

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. This holds package.json to strict JSON:

    - id: jsonvet
      args: [--strict, package.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. It runs on Linux, macOS and Windows runners. Before it installs jsonvet from PyPI, it checks that the wheel came from this repository's release workflow. Its optional inputs are in the reference.

Command line

uvx jsonvet config/*.json        # run it from PyPI without installing
uvx jsonvet .                    # check every JSON-like file under a folder
pip install jsonvet              # install it as a Python package
cargo install jsonvet-cli        # build it from source
cargo binstall jsonvet-cli       # download the binary from the GitHub release

Each GitHub release after 3.0.0 also has the jsonvet binary for Linux (glibc and musl), macOS and Windows, on x86-64 and ARM64, as jsonvet-<target>.tar.gz (.zip on Windows), with a SHA256SUMS file and a CycloneDX SBOM. To check that a file came from this repository's release workflow, see SECURITY.md.

A folder stands for the files under it with an extension or name from the dialect table below, skipping hidden files and what .gitignore names, as ripgrep does. A file you name is always checked. - reads standard input. jsonvet --list-rules lists the rules, --explain RULE explains one, and jsonvet --help lists every option. The reference has the details, the output formats and the exit status.

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

Change a rule's severity with --error, --warn or --ignore. 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" }

# 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/*"]

For each file, jsonvet uses the nearest one in the file's folder or a parent, up to the repository root, so each package in a monorepo can have its own. The nearest file replaces any further up; nothing is merged. With none, jsonvet uses your own jsonvet/jsonvet.toml in your config folder, such as ~/.config, if you have one. Options on the command line win. The reference says where jsonvet looks and how globs match.

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)

In the hook, give each schema its own entry:

    - id: jsonvet
      name: jsonvet (server schema)
      files: ^config/server\.json5$
      args: [--schema, schemas/server.schema.json]

Schema errors are always errors. jsonvet never fetches a schema from the network or another file, so every $ref must point inside the schema file. The other limits are in the reference.

GitHub code scanning

--format sarif prints a SARIF 2.1.0 document for GitHub code scanning. The Action's sarif input writes one for you to upload:

jobs:
  jsonvet:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      security-events: write
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
        with:
          persist-credentials: false
      - uses: simonvanlierde/jsonvet@v3
        with:
          sarif: jsonvet.sarif
      # Upload when jsonvet found problems too: that is when the step fails.
      - uses: github/codeql-action/upload-sarif@24c54180a607b1449ed407dd24f251e4e9147c8d # v4.38.3
        if: success() || failure()
        with:
          sarif_file: jsonvet.sarif

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.

For the files check-json5 knew, jsonvet gives the same pass or fail as 1.4.1, apart from a few edge cases listed in docs/design.md. 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. The other changes are in the reference.

How it is tested

jsonvet runs the json5-tests suite, edge-case snapshots, property tests, fuzzing, mutation testing and a comparison with check-json5 1.4.1, on Linux, macOS and Windows. A conformance matrix runs the same files against 18 other parsers in four languages:

dialect files share of files where each parser gives the expected verdict
JSON5 166 js-json5 100%, jsonvet-json5 100%, rs-json5 100%, py-json5 99%, py-pyjson5 99%, rs-serde-json5 94%, go-json5 91%
JSONC 9 js-jsonc-parser 100%, jsonvet-jsonc 100%, go-tidwall-jsonc 89%, js-strip-json-comments 89%, rs-jsonc-parser 78%
JWCC (HuJSON) 10 jsonvet-jwcc 100%, go-hujson 90%
JSON Lines 11 jsonvet-jsonl 100%, py-jsonlines 82%, go-json-stream 64%, rs-serde-json-stream 64%
Strict JSON (baseline) 129 js-json-parse 100%, jsonvet-json 100%, rs-serde-json 98%, py-json 96%, py-jiter 95%

Run on 2026-10-19. The full grid, and where each expected verdict comes from: docs/conformance.md.

More

  • Reference: every option and limit in detail.
  • Design: why it works the way it does, with the speed figures.
  • CHANGELOG: what changed in each release.
  • CONTRIBUTING.md: how to build, test and release it.

Found a file jsonvet gets wrong? Please open an issue with the file and the command you ran. 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. It is MIT-licensed, like both of them.

Metadata

Release files for jsonvet 3.1.1

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.1.1
File Size Uploaded Provenance Actions
jsonvet-3.1.1.tar.gz 157.5 kB With provenance Details for jsonvet-3.1.1.tar.gz

Built distributions (wheels)

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

Total release size: 34.9 MB

Release files / jsonvet-3.1.1.tar.gz

Download URL jsonvet-3.1.1.tar.gz
Size 157.5 kB
Tags Source
SHA-256 checksum
How to use checksums
7445d73a7728bdc385117665d7e7a5337144be67b8b112b4b93c29a1ca86c7b9
BLAKE2b-256 checksum
How to use checksums
c9762ee51929713b34bef091e489dcb932a51c2a8670897d904d8d4a29b12dc2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 21, 2026.

Transparency log

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

Download URL jsonvet-3.1.1-py3-none-win_arm64.whl
Size 3.8 MB
Tags Python 3 Windows ARM64
SHA-256 checksum
How to use checksums
9bbb838191338f83fa96a7819846412b25d9f64d957355a1345a05e4998f488b
BLAKE2b-256 checksum
How to use checksums
b9d4f3d6169ca695c144d8fe476e45650c4af55681e1242032647dc3501fa325
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 21, 2026.

Transparency log

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

Download URL jsonvet-3.1.1-py3-none-win_amd64.whl
Size 4.3 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
deded12c4793847f23b7274e35f1eec8f444efdfa7b7fdc9edbdb6f94b8fa649
BLAKE2b-256 checksum
How to use checksums
5a2f68f2aab284539ffd9ceac4d44f48e2b88ba6b171e16a232d6b8f42a66367
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 21, 2026.

Transparency log

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

Download URL jsonvet-3.1.1-py3-none-musllinux_1_2_x86_64.whl
Size 4.8 MB
Tags Linux musl 1.2+ x86-64 Python 3
SHA-256 checksum
How to use checksums
f1650be41e15c11df5926367441286c588ff30650b7075987dd7f554a3c36e18
BLAKE2b-256 checksum
How to use checksums
84ad2df3017a1171c9de32c4d715ffaa5630b7ee7cdc58788eb3eef9a522dd9c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 21, 2026.

Transparency log

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

Download URL jsonvet-3.1.1-py3-none-musllinux_1_2_aarch64.whl
Size 4.3 MB
Tags Linux musl 1.2+ ARM64 Python 3
SHA-256 checksum
How to use checksums
1fb9a59acaa17dfddc969c533a1e968f1cdd992f72c5992e0810a654cbf4bc68
BLAKE2b-256 checksum
How to use checksums
2f15e19769c29e0f8fcb9c4d1123a7d2cfe9ef90a0a8d7e6d4a1c83c67952cf9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 21, 2026.

Transparency log

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

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

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 Oct 21, 2026.

Transparency log

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

Download URL jsonvet-3.1.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 4.3 MB
Tags Linux glibc 2.17+ ARM64 Python 3
SHA-256 checksum
How to use checksums
c578c27d90c85377c24beb753d18be9ba266fbe3b1448efa828013fdbf1dd65e
BLAKE2b-256 checksum
How to use checksums
7110b796c70a3213f6a737096c6eda47fdc324fce210929019268e515131aed3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 21, 2026.

Transparency log

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

Download URL jsonvet-3.1.1-py3-none-macosx_11_0_arm64.whl
Size 4.0 MB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
850c8bdf0f8743494acdfeb92d7cf5c5935830dac5406fddbdc9baaf06729219
BLAKE2b-256 checksum
How to use checksums
507a3ce601f64009fa8992c60203ce0190a3053fb187a32936b528736b62d288
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 21, 2026.

Transparency log

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

Download URL jsonvet-3.1.1-py3-none-macosx_10_12_x86_64.whl
Size 4.5 MB
Tags Python 3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
224281ee9ff5659dff9be27dd4a43e5c80000c12f0853ffa27488bd89af6c35c
BLAKE2b-256 checksum
How to use checksums
ec468f246565d559c1167eca780c6652b6b7a1826443e789e9301b269caa7f04
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 21, 2026.

Transparency log

Security for jsonvet 3.1.1

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.1.1.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 Oct 21, 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