JSON
Must have Python 2.6 or higher version installed.
After copying unformatted JSON to clipboard (ctrl+c), run this:
From Clipboard
After copying unformatted JSON to clipboard (ctrl+c), run this:
pbpaste | python -m json.tool
From File
After saving unformatted JSON to a file called, for example, ugly.json, run this to write it to a file called pretty.json:
cat ugly.json | python -m json.tool > pretty.json
XML
From Clipboard
After copying unformatted XML to clipboard (ctrl+c), run this:
pbpaste | xmllint --format -
pbpaste | xmllint --format -
From File
After saving unformatted XML to a file called, for example, ugly.xml, run this to write it to a file called pretty.xml:
cat ugly.xml | xmllint --format -o pretty.xml -
No comments:
Post a Comment