Fetching JSON data with Emacs Lisp
The following snippet of Emacs Lisp will fetch a remote URI and return the contents as a parsed JSON object.
(defun get-json (uri)
"Fetch the contents of URI and parse."
(with-current-buffer (url-retrieve-synchronously uri)
(goto-char (point-min))
(goto-char url-http-end-of-headers)
(prog1 (json-read)
(kill-buffer))))
Something like:
{
"field" : "value"
}
will return an object like this:
'((field . "value"))