Skip to main content

Console utility for pretty JSON output

Project description

Simple python utility for using in shell scripts.

Features

  • Print colorized JSON
  • Minimized and formatted output
  • Output elements by keys and indexes
  • Check JSON for correctness
  • Automatically disabling color sequences, when prints to pipeline, file or other non-tty output

Examples

  • test.json
{
  "arr": [
    123,
    "λάμβδα ラムダ lambda",
    [
      "1",
      "2"
    ]
  ],
  "test": "test"
}
  • Colorized indented
printjson test.json
  • Minimized monochrome
printjson -om test.json

Result:

{"test":"test","arr":[123,"λάμβδα ラムダ lambda",["1","2"]]}
  • Print third entry of “arr” array, using “__” as delimiter
printjson -k 'arr__2' -d '__' test.json

Result:

[
  "1",
  "2"
]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for printjson, version 1.0.1
Filename, size File type Python version Upload date Hashes
Filename, size printjson-1.0.1.tar.gz (4.9 kB) File type Source Python version None Upload date Hashes View
Filename, size printjson-1.0.1-py2.py3-none-any.whl (5.9 kB) File type Wheel Python version py2.py3 Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page