Linting json
jq
- see jq.md
- Cannot lint
hujsonorjsonc
check-jsonschema
Buildin schemas
- Builtin schemas
- see also src/check_jsonschema/builtin_schemas
- The '--builtin-schema' flag supports the following schema names:
- vendor.azure-pipelines
- vendor.bamboo-spec
- vendor.bitbucket-pipelines
- vendor.buildkite
- vendor.circle-ci
- vendor.cloudbuild
- vendor.dependabot
- vendor.drone-ci
- vendor.github-actions
- vendor.github-workflows
- vendor.gitlab-ci
- vendor.readthedocs
- vendor.renovate
- vendor.taskfile
- vendor.travis
- vendor.woodpecker-ci
- custom.github-workflows-require-timeout
Here the most interesting:
gitlab-ci- Validate GitLab CI config against the schema provided by SchemaStoregithub-actionsgithub-workflowsreadthedocsrenovate
Install
sudo pacman -S check-jsonschema
cli usage
Builtin schema:
check-jsonschema --builtin-schema vendor.gitlab-ci .gitlab-ci.yml
Schema URL:
check-jsonschema -v \
--schemafile https://raw.githubusercontent.com/goss-org/goss/master/docs/schema.yaml \
goss.yaml
pre-commit usage
repos:
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.23.2
hooks:
- id: check-gitlab-ci
Other linters
- json5format
- JSON5 formatter that preserves contextual comments
- Removes quotes from keys which breaks
hujson
- hujsonfmt
- Formatter for
hujson - Uses tabs instead of spaces, not configurable
- Use
json5filetype in Neovim for syntax highlighting
- Formatter for
- json-repair
- A python module to repair invalid JSON from LLMs
Language servers
- hrsh7th/jsonls
- No configuration possible, complains about trailing commas in i.e.
hujson - Integrated in nvim-lspconfig
- Last release 2024-05
- No configuration possible, complains about trailing commas in i.e.
Outdated
- fixjson
- Last commit 2023-01
- Integrated in conform.nvim
- Removes comments !
- python3-demjson: Unmaintained, last commit 2015
- Seldaek/jsonlint: php, unmaintained
- zaach/jsonlint
- Last commit 2021