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
Hashes for prettyson-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3de755386fff5266dd17715ca2c843632e6a72fc2261df9864d5286d5008d6c4 |
|
MD5 | d918968d83dc75af323d021f9e48a895 |
|
BLAKE2b-256 | efbdf3e10a732044939a2d8401467a5c4581934be8ee2f8a4d9a81f13192d045 |