Pretty-printing JSON and XML on Mac OSX
richardlog.com
Pretty-printing JSON and XML on Mac OSX
1–10 of 11 posts
Re: Pretty-printing JSON and XML on Mac OSX
#2Re: Pretty-printing JSON and XML on Mac OSX
#3Hey! Why not use https://github.com/nicksieger/jsonpretty for pretty printing JSON?
There's definitely better tools out there if you're willing to install something - but these are great when you're in a pinch.
Re: Pretty-printing JSON and XML on Mac OSX
#4 tidy -xml -q -i
etc.Re: Pretty-printing JSON and XML on Mac OSX
#5So if the incoming XML had an empty tag specified as xmllint will turn it into . If you're specifically looking for for some reason, then that could trip you up.
Shouldn't matter 99% of the time though.
Re: Pretty-printing JSON and XML on Mac OSX
#6A neat set of tricks, hopefully they'll replace jsonlint.com in my brain, and soon :)
Re: Pretty-printing JSON and XML on Mac OSX
#7You could also just pipe it back into the clipboard with | pbcopy :) A neat set of tricks, hopefully they'll replace jsonlint.com in my brain, and soon :)
Re: Pretty-printing JSON and XML on Mac OSX
#8It's saved me countless hours debugging web services, be it JSON, XML, AMF, you name it. There's a free 30 day trial, and it runs on Mac OSX, Windows, and Linux.
Re: Pretty-printing JSON and XML on Mac OSX
#9 alias json="python -mjson.tool"
alias xml="xmllint --format -"
then pipe into them like so: echo '{"one": 1}' | json
echo "1" | xml