Code formatter, beautifier, pretty printer.
With jq (available in Debian/Cygwin):
$ jq $FILE $ curl -s http://.../... | jq
By default jq produce colorized output in terminal!
With Python 2.6+:
$ python -m simplejson.tool $FILE $ python -m json.tool $FILE
In terminal you can add color support with pygmentize:
$ curl -s http://.../... | python -m simplejson.tool | pygmentize -l json
With tidy:
$ tidy -xml -i -utf8 -o out.xml in.xml
or in Emacs:
C-x h C-x <RET> c utf-8 <RET> C-u M-| tidy -q -xml -i -utf8 -
With xmllint:
$ xmllint --format file.xml
Pretty print XMLs in place:
for f in *.xml; do xmllint -o $f --format $f; done
In Emacs:
: C-x h C-u M-| xmllint --format - <RET>
With Emacs and nxml you need introduce line-breaks and then:
C-x h C-M-\
A Free, Fast and Small Automatic Formatter for C, C++, C#, and Java Source Code.
There are exist package for Cygwin, Debian.
Source Code Beautifier for C, C++, C#, ObjectiveC, D, Java, Pawn and VALA.
Exist package for Windows (binary from home page), Debian.