Search code examples
javascriptjsonobjectemacs

Emacs command to convert JS Object to JSON


Is there an emacs library or command to convert JS Object to JSON?

Something such as {a:"b", c:1} to {"a":"b", "c":1} with a command M-x wrap-to-json


Solution

  • Short answer seems to be "no". I've done some (shallow) research, and the only Emacs packages which handle JSON are json.el (part of the standard distribution as of 23.1), and json-mode, which is available with package.el. The former deals with serialization of JSON to and from elisp data structures, and the latter is a major mode for editing JSON.

    Source: Emacs Wiki