Roine

How to prettify a JSON object using the OSX shell

August 29, 2019

I often need to prettify a JSON and always end up googling json format online, pasting my JSON and copying the result. With the following alias I can just copy my JSON, type jsonformat in the shell and magic the formatted JSON is in my clipboard.

alias jsonformat="pbpaste | python -m json.tool | pbcopy"