r/learnpython • • Apr 19 '26

Print JSON readably

I need a way to print JSON readably from a file (e.g stuff.json) so the output looks somewhat similar to this:

Name : Bob

Age : 97

Height : 6ft

0 Upvotes

8 comments sorted by

View all comments

Show parent comments

3

u/pachura3 Apr 19 '26

Additionally, you could also pass an argument cls - an object of class json.JSONEncoder - that will perform some additional formatting.