prettify json in emacs

#emacs#json
at

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 In fact, C-u is a source of suprises prefix, here, it was output in current buffer. M-| is shell-command-on-region 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)
  ))
« Always Objective C asynchronous operation more async when in async test