A Python-based JSON file formatter
Project description
prettyson
A Python-based JSON file formatter, inspired by Black.
installation
You can install prettyson
via pip
:
$ python3 -m pip install prettyson
how to use
Using prettyson
is very simple; you just pass it the JSON files you want to format.
$ prettyson my_json_file.json my_json_files/*.json
By default, prettyson
will reformat your files in-place if they are incorrectly
formatted. If you just want to check your files, but not reformat them (as you would
in a pre-commit or CI context for example), you can use the dry run option:
$ prettyson --dry-run my_json_file.json
If you also want it to sort the JSON keys, use the sort option:
$ prettyson --sort my_json_file.json
By default, the indentation that is used is four spaces; you could specify a different amount of spaces via the indent option, or use tabs instead via the use tabs option:
$ prettyson --indent 2 my_json_file.json # 2-space indentation
$ prettyson --use-tabs my_json_file.json # tab indentation
You can get an exhaustive list of options by running:
$ prettyson --help
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file prettyson-0.0.2.tar.gz
.
File metadata
- Download URL: prettyson-0.0.2.tar.gz
- Upload date:
- Size: 16.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | aad9c642dff02fbd36a87e66649ea35cc2c4f4d9bb7dc1e3909d98b47f500533 |
|
MD5 | 54357364cd17dcb73540867c99d2612c |
|
BLAKE2b-256 | d7f3ec648277668807f8483d5225cb30d02ea35ac3d9b824cfa307785ed10ee5 |
File details
Details for the file prettyson-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: prettyson-0.0.2-py3-none-any.whl
- Upload date:
- Size: 18.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3de755386fff5266dd17715ca2c843632e6a72fc2261df9864d5286d5008d6c4 |
|
MD5 | d918968d83dc75af323d021f9e48a895 |
|
BLAKE2b-256 | efbdf3e10a732044939a2d8401467a5c4581934be8ee2f8a4d9a81f13192d045 |