Wednesday, February 08, 2017

How to format a json file in Emacs with manual install

Today I needed to reformat a ginormous json file, but could not use the package-manager instructions for Emacs at github.com/joshwnj/json-modefor fire-wall/network issues.

So I manually installed all the needed files and put this in my .emacs file:

(require 'json-snatcher) ;from https://github.com/Sterlingg/json-snatcher
(require 'json-reformat) ;from https://github.com/gongo/json-reformat
(require 'json-mode) ;from https://github.com/joshwnj/json-mode;

 Then to format a file, select all (c-x h) then  m-x  json-reformat-region.  Works like a charm.

Thanks to the contributors for creating these packages!