# 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.
```bash
$ pip install json-linter
```
## Usage
```bash
# 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
```python
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
![](https://www.gnu.org/graphics/gplv3-127x51.png)
Raw data
{
"_id": null,
"home_page": "https://github.com/atomicptr/json-linter",
"name": "json-linter",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": "",
"keywords": "",
"author": "Christopher Kaster",
"author_email": "me@atomicptr.de",
"download_url": "",
"platform": null,
"description": "# json-linter\n\nLint your JSON files!\n\n## Features\n\n* Check if keys are sorted alphabetically...\n* Check if your keys are either in camelCase, snake\\_case or kebab-case...\n* ...and automatically fix (some) of these issues!\n\n## Install\n\nYou need to have Python 3.10+ installed.\n\n```bash\n$ pip install json-linter\n```\n\n## Usage\n\n```bash\n# Lint a single file...\n$ json-linter my-file.json\n\n# Lint multiple files...\n$ json-linter a.json b.json\n\n# Lint all files in a directory\n$ json-linter files\n\n# Lint all files in a directory recursively\n$ json-linter files --recursive\n\n# Lint all files in a directory recursively with .config and .cfg ending\n$ json-linter files -r --extensions cfg config\n\n# Fix files (will overwrite the file with a fixed version and then lint)\n$ json-linter my-file.json --fix\n\n# Overwrite configuration values\n$ json-linter my-file.json --config-set naming_style=KEBAB_CASE indent=2\n\n# Return results as json\n$ json-linter my-file.json --json\n```\n\n### Use as a package\n\n```python\nfrom pathlib import Path\n\nfrom json_linter import lint_file\n\n\nresults = lint_file(Path(\"./my-file.json\"))\n\nfor result in results:\n if not result.was_successful:\n print(result.path, \"failed!\")\n\n```\n\n## License\n\nGNU General Public License v3\n\n![](https://www.gnu.org/graphics/gplv3-127x51.png)\n\n\n",
"bugtrack_url": null,
"license": "",
"summary": "Lint your JSON files!",
"version": "1.3.0",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "cc082ea4042af055e37e7bc7fa7fde65",
"sha256": "5af94acdc3e960e1b6963595065bbc2c97d1823900cdeb5562de6c34ec46eeb1"
},
"downloads": -1,
"filename": "json_linter-1.3.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "cc082ea4042af055e37e7bc7fa7fde65",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 23240,
"upload_time": "2022-12-14T09:58:13",
"upload_time_iso_8601": "2022-12-14T09:58:13.718723Z",
"url": "https://files.pythonhosted.org/packages/6b/98/b937164dc576f35921a42ee6acc2579c05d480b17b2ea0346abaf5eec122/json_linter-1.3.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-12-14 09:58:13",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "atomicptr",
"github_project": "json-linter",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "json-linter"
}