Pretty Format JSON
Pretty print JSON containing Python-style comments and string literals.
pip3 install pretty-format-json
Binaries
pretty_format_json: convert text to JSON, supports Python style (comments, single quotes, trailing commas) and NodeJS style (bare keys, JS booleans)csv_json: convert between CSV and JSONyaml_json: convert between YAML and JSON
Usage
echo "{a: 1, 'b': 2,}" | pretty_format_json
Use it in VIM
Add the following lines to your config file:
noremap <a-j> :%!pretty_format_json<CR>
noremap <a-k> :%!yaml_json<CR>
noremap <a-c> :%!csv_json<CR>
When you open a blank buffer, paste the text copied from somewhere,
then use Alt+j to convert to JSON,
use Alt+k to convert to YAML and back to JSON.
Environment variables
JSON_INDENT: indent width (default 2)JSON_SORT_KEYS: sort keys if setDATE_FORMAT: datetime output format (default ISO)
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pretty_format_json-0.2.23.tar.gz.
File metadata
- Download URL: pretty_format_json-0.2.23.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f7a0a9087136584aa966555d07ca31cd0a450ef9cf8a3ac180052a99e5cfba48
|
|
| MD5 |
89615dd3700861da2b277910a4693a34
|
|
| BLAKE2b-256 |
d1a306326844b2a274929a43eaa084ede188bdee7b1149c29b8ecd54e1f7f955
|
File details
Details for the file pretty_format_json-0.2.23-py3-none-any.whl.
File metadata
- Download URL: pretty_format_json-0.2.23-py3-none-any.whl
- Upload date:
- Size: 6.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
62a5479cc2265d75783043bcd03fecfe9ea6ac98570d6f48146df9940e59100d
|
|
| MD5 |
553ff2ab816038183d5235237e243940
|
|
| BLAKE2b-256 |
93d3804123f480e6d08291b1d5610e98ee031f04990884b89ec989a3047c07dd
|