make pretty json
Project description
prettify-json
make pretty json.
Documentation: https://github.com/VeritasXu/prettify-json
Installation
pip install prettify-json
Usage
import json
import prettify_json as pj
# raw contents for json
boxes = [[1, 2, 3, 4],
[2, 3, 1, 4]]
sample = {'id': 1}
# wrap data that want to indent = 0
sample['boxes'] = pj.NoIndent(boxes)
# dumps
json_data = pj.dumps(sample, indent=2)
print(json_data)
# write json
pj.write_json(sample, './tmp.json', indent=2)
# compare with raw
sample['boxes'] = boxes
raw_json = json.dumps(sample, indent=2)
print(raw_json)
See default sample
from prettify_json import sample
raw, new = sample()
print('+++++++++ old +++++++++')
print(raw)
print('+++++++++ pretty +++++++++')
print(new)
With Prettify
Without Prettify
Authors
See contributors section on GitHub.
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
prettify_json-0.1.1.tar.gz
(3.2 kB
view details)
Built Distribution
File details
Details for the file prettify_json-0.1.1.tar.gz
.
File metadata
- Download URL: prettify_json-0.1.1.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.8.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1eb811e2ab7103b8d50142fcbdabb6dd051c66a461be8c95ed4740898ec859e5 |
|
MD5 | 064b626076739b53a4d1b06985e7c8ea |
|
BLAKE2b-256 | 67be6b7286b2f51b24111a29f4be25ba3c7593df79b0dcaa204447bc12145fb7 |
File details
Details for the file prettify_json-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: prettify_json-0.1.1-py3-none-any.whl
- Upload date:
- Size: 3.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.8.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 362c987ade161f0c3ed3efed549e1a08c0cede58b4c723e6e55c02601a2263aa |
|
MD5 | e1eb11914a6110cb0b7f2cc9b9c87ffe |
|
BLAKE2b-256 | 32819f1d89e4edfe4bd7ab3bd3397bcb16cec41d7de2ff945ac359cc4e0d3bce |