Pretty Format Json in Emacs
Wednesday, May 29th, 2013To format json data in emacs, its best to use the python module ‘json.tool’. Simply make a function to wrap up the whole buffer and format it.
(defun json-format ()
(interactive)
(save-excursion
(shell-command-on-region (point-min) (point-max) "python -m json.tool" (buffer-name) t)
)
)