One-liner JSON pretty print

Pretty-print a JSON file using stdlib

python3 -m json.tool < input.json

tool
python15 commands
tags
python

More python commands

  • python3 -m cProfile -s cumulative script.py | head -30

    CPU profiling sorted by cumulative time

  • python3 -m pdb script.py

    Start script under the Python debugger

  • breakpoint() # Python 3.7+ — drops into pdb at this line

    Built-in breakpoint() is equivalent to import pdb; pdb.set_trace()

  • pytest -x -v --tb=short tests/

    Stop at first failure, verbose, short traceback

  • python3 -m py_compile script.py && echo OK

    Compile to bytecode only to catch syntax errors

all 15 python commands