prettify json in emacs#emacs#json
prettify json in emacs
emacs always give me suprises.. Even I use emacs at least five years.
Yet a new skill to pretty print json in you buffer.
any region you marked.
C-u M-| type in
python -m json.tool
C-u is a source of suprises prefix, here, it was output in current buffer.
We just take advantage of the python tools to prettify json. (OMG, many scripts can be used here…)
alternatively, use this function instead:
(defun json-pretiffy () (interactive) (save-excursion (shell-command-on-region (mark) (point) "python -m json.tool" (buffer-name) t) ))