Files
cheatsheet-tldr/tldr/python-m-json.tool
2025-06-16 00:21:27 +00:00

19 lines
461 B
Bash

---
syntax: markdown
tags: [tldr, common]
source: https://github.com/tldr-pages/tldr.git
---
# 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 standard input:
`echo '{{{"key": "value"}}}' | python -m json.tool`