Simple json printer for python
Project description
jprint2
Print any object in JSON. Built on top of jsons for formatting and pygments for colorizing.
Basic usage
from jprint2 import jprint, jformat, set_defaults
# - Print json
jprint({"name": "Mark", "age": 30}) # {"name": "Mark", "age": 30}
# - Keeps strings by default as is to preserve json objects
jprint("Mark") # Mark
jprint('{"name": "Mark"}') # {"name": "Mark"}
jprint('{"name": "Mark"}', keep_strings=False) # "{\"name\": \"Mark\"}"
# - Set defaults of your liking
set_defaults(
indent=2,
sort_keys=True
)
# - Format json
my_json_string = jformat({"name": "Mark", "age": 30})
# - Override defaults
jprint({"name": "🧙♂️", "age": 30}, ensure_ascii=True) # {"name": "\ud83e\uddd9\u200d\u2642\ufe0f", "age": 30}
License
MIT License
Author
Mark Lidenberg marklidenberg@gmail.com
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
jprint2-0.1.1.tar.gz
(68.7 kB
view details)
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 jprint2-0.1.1.tar.gz.
File metadata
- Download URL: jprint2-0.1.1.tar.gz
- Upload date:
- Size: 68.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
670a2e057a11dbffbb2ade5a03c4070c378c02d64901a55bc210a0df63f753bb
|
|
| MD5 |
d2279ab5f9d4f9a42c05cb2b8c38b892
|
|
| BLAKE2b-256 |
536f14e2ce29ba5a3d59feac828ff4dae24af9c9c0c3978532c32165eccc58f3
|
File details
Details for the file jprint2-0.1.1-py3-none-any.whl.
File metadata
- Download URL: jprint2-0.1.1-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ca7df7597a4f97290bb93da48bbc58420f37bc9dfa3035cce1db3b7b38c19986
|
|
| MD5 |
7e70089cd3d1d620d05f99008204feb5
|
|
| BLAKE2b-256 |
4e9678ed72c0b60dad41ed6e050ab0a37be629a5cd8f3a1118099f9e1e116d65
|