Pretty print a JSON file
Use below command to pretty print the content of a JSON file on terminal using Python
Python: 3.0    Anurag Rana    06 Sep 2021   0
Login to upvote
1
2
3
4
5
6
7
8
# Assuming there is a file named a.py in current folder with the below content
# {"name":"rana", "year":"2021"}
cat a.json | python3 -m json.tool
# output
# {
#    "name": "rana",
#    "year": "2021"
# }
Copy | Download as: .py file   PNG
Share on: FB   Twitter   LinkedIn   WA
©2021 - code108labs   Contributors   Hosted on DigitalOcean   Partner website: pythoncircle.com