Skip to main content

json-linter

Lint your JSON files!

Features

  • Check if keys are sorted alphabetically...
  • Check if your keys are either in camelCase, snake_case or kebab-case...
  • ...and automatically fix (some) of these issues!

Install

You need to have Python 3.10+ installed.

$ pip install json-linter

Usage

# Lint a single file...
$ json-linter my-file.json

# Lint multiple files...
$ json-linter a.json b.json

# Lint all files in a directory
$ json-linter files

# Lint all files in a directory recursively
$ json-linter files --recursive

# Lint all files in a directory recursively with .config and .cfg ending
$ json-linter files -r --extensions cfg config

# Fix files (will overwrite the file with a fixed version and then lint)
$ json-linter my-file.json --fix

# Overwrite configuration values
$ json-linter my-file.json --config-set naming_style=KEBAB_CASE indent=2

# Return results as json
$ json-linter my-file.json --json

Use as a package

from pathlib import Path

from json_linter import lint_file


results = lint_file(Path("./my-file.json"))

for result in results:
    if not result.was_successful:
        print(result.path, "failed!")

License

GNU General Public License v3

Metadata

Release files for json-linter 1.3.0

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

Built distribution (wheel)

Table of built distributions (wheels) for json-linter 1.3.0
File Interpreter ABI Platform Actions
json_linter-1.3.0-py3-none-any.whl Python 3 none any Details for json_linter-1.3.0-py3-none-any.whl

Release files / json_linter-1.3.0-py3-none-any.whl

Download URL json_linter-1.3.0-py3-none-any.whl
Size 23.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5af94acdc3e960e1b6963595065bbc2c97d1823900cdeb5562de6c34ec46eeb1
BLAKE2b-256 checksum
How to use checksums
6b98b937164dc576f35921a42ee6acc2579c05d480b17b2ea0346abaf5eec122
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.0

Security for json-linter 1.3.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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