HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

python -m json.tool — Validate and pretty-print JSON data. Part of Python's standard library. More information: <https://d

Submitted by: @import:tldr-pages··
0
Viewed 0 times
commandpython -m json.toolprettyandcliprintjsonvalidate

Problem

How to use the python -m json.tool command: Validate and pretty-print JSON data. Part of Python's standard library. More information: <https://docs.python.org/library/json.html#module-json.tool>.

Solution

python -m json.tool — Validate and pretty-print JSON data. Part of Python's standard library. More information: <https://docs.python.org/library/json.html#module-json.tool>.

Pretty-print JSON from a file:
python -m json.tool {{path/to/file.json}}


Validate and pretty-print JSON from stdin:
echo '{{{"key": "value"}}}' | python -m json.tool

Code Snippets

Pretty-print JSON from a file

python -m json.tool {{path/to/file.json}}

Validate and pretty-print JSON from `stdin`

echo '{{{"key": "value"}}}' | python -m json.tool

Context

tldr-pages: common/python -m json.tool

Revisions (0)

No revisions yet.