Pretty print json.
authorOleksandr Gavenko <gavenkoa@gmail.com>
Sun, 19 Feb 2017 12:33:28 +0200
changeset 2096 bb22372fc204
parent 2095 b9bf144836b8
child 2097 614569553a08
Pretty print json.
prettyprint.rst
--- a/prettyprint.rst	Sat Feb 18 16:16:35 2017 +0200
+++ b/prettyprint.rst	Sun Feb 19 12:33:28 2017 +0200
@@ -11,15 +11,24 @@
 
 Code formatter, beautifier, pretty printer.
 
-  http://en.wikipedia.org/wiki/Pretty-printer
-                Wiki article.
+http://en.wikipedia.org/wiki/Pretty-printer
+  Wiki article on pretty printing.
 
-xml.
+json
 ====
 
-tidy.
------
-::
+With Python 2.6+::
+
+  $ python -m simplejson.tool  $FILE
+
+In terminal you can add color support with ``pygmentize``::
+
+  $ curl -s http://.../... | python -m simplejson.tool | pygmentize -l json
+
+xml
+===
+
+With tidy::
 
   $ tidy -xml -i -utf8 -o out.xml in.xml
 
@@ -27,32 +36,24 @@
 
   C-x h C-x <RET> c utf-8 <RET> C-u M-| tidy -q -xml -i -utf8 -
 
-  http://tidy.sourceforge.net
-                Home page.
-  http://www.emacswiki.org/cgi-bin/wiki/tidy.el
-                Emacs bindings.
-
-xmllint.
---------
-::
+With xmllint::
 
   $ xmllint --format file.xml
 
-or in Emacs:
+or in Emacs::
 
   : C-x h C-u M-| xmllint --format - <RET>
 
-Emacs and nxml.
----------------
-
-You need introduce line-breaks and then::
+With Emacs and nxml you need introduce line-breaks and then::
 
   C-x h C-M-\
 
-xmlindent.
-----------
-
-  http://xmlindent.sourceforge.net/
+http://tidy.sourceforge.net
+  Home page.
+http://www.emacswiki.org/cgi-bin/wiki/tidy.el
+  Emacs bindings.
+http://xmlindent.sourceforge.net/
+  xmlindent home page.
 
 c/c++/java/c#.
 ==============
@@ -88,6 +89,6 @@
 Perl.
 =====
 
-  http://perltidy.sourceforge.net/
-                Home page.
+http://perltidy.sourceforge.net/
+  Home page.