Skip to main content

Simple json printer for python

Project description

jprint2

A drop-in replacement for print that formats output as JSON using jsons and colorizes it with pygments.

Example

Usage

>>> from jprint2 import jprint
>>> jprint("a", "b", "c")
[
  "a",
  "b",
  "c"
]
>>> jprint({"name": "Mark", "mood": 10})
{
  "name": "Mark",
  "mood": 10
}
>>> jprint("Mark")
Mark
>>> jprint('{"name": "Mark"}')
{
  "name": "Mark"
}
>>> from jprint2 import override_print
>>> override_print()
>>> print("Hello", "friend!")
[
  "Hello",
  "friend!"
]
>>> from jprint2 import set_defaults
>>> set_defaults(indent=2, sort_keys=True)
>>> from jprint2 import jformat
>>> my_json_string = jformat({"name": "Mark", "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.2.0.tar.gz (41.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jprint2-0.2.0-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file jprint2-0.2.0.tar.gz.

File metadata

  • Download URL: jprint2-0.2.0.tar.gz
  • Upload date:
  • Size: 41.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.2

File hashes

Hashes for jprint2-0.2.0.tar.gz
Algorithm Hash digest
SHA256 2a1eb3abd89f2add4be36b5032a6c3cb4148a07147187954b0cab7245b473e92
MD5 90dfe0e09077e25cb2d229baaf1fea67
BLAKE2b-256 dea31bf854b38185d062f451de8e8c0569592c5bc59711f076d4c8fa31c58c87

See more details on using hashes here.

File details

Details for the file jprint2-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: jprint2-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.2

File hashes

Hashes for jprint2-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1f465ae8a059dada02a0cb91630e187c3c8ed84a0b93178faa242b2bc9492670
MD5 5d0ae010660e7091f2081aada1ddd66d
BLAKE2b-256 8bb11992f6425301c6882b5baa1d5719a1f898ca22f094db05419b7d9cd514ba

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page