Let's look at what we have at our disposal to work with json in Emacs, both such as a user (editing json files) and as an elisp developper.

Editing and working in json files

json-mode

The json-mode json-mode (in MELPA and MELPA stable) offers:

syntax highlighting and indentation,

format the region or buffer, with json-reformat. Bound to C-c C-f .

the region or buffer, with json-reformat. Bound to . display the path of the object at point, with json-snatcher. Bound to C-c C-p .

It actually inherits from js-mode to add better syntax highlighting for JSON.

Format json

Starting from Emacs 24.4 we have the built-in commands json-pretty-print and json-pretty-print-buffer .

Anyways there also is the json-reformat package, in MELPA.

web-beautify can also format html, css and javascript, based on the js-beautify package on the npm registry.

flymake-json

flymake-json is a Flymake handler for json using "jsonlint" from the npm package registry.

See also flycheck-demjsonlint to be able to specify linting rules.

x-path-walker - Navigate json/htm/xml based on the elements' path

x-path-walker (in MELPA) offers an Helm interface to ease the navigation of json files.

json-navigator - navigate json presented as a tree

json-navigator (in MELPA, for Emacs >= 25.1 only) allows to display any JSON document as a tree, which leafs you can unfold and follow.

It is an example of the hierarchy project.

json-snatcher - get the path of a json element

See json-snatcher:

Development

Parsing and generating json

With the built-in json.el library.

See also

Request json content

See request.el that allows to request content to http endpoints and parse the result to json.

Using js2-mode functions