Does anybody know a good Emacs mode to edit JSON? An app I am working on uses a JSON based communication protocol and having the data nicely indented and syntax-highlighted would help me a lot in the process of figuring it out.
+1
A:
If you can't find a JSON-specific mode, try one of the many Javascript modes, since JSON is after all really just Javascript:
Don Wakefield
2009-01-12 15:58:15
JSON is not really supported by js2-mode, though.http://code.google.com/p/js2-mode/issues/detail?id=50
Török Gábor
2009-04-18 00:48:53
A:
I would also recommand js2-mode.
JSON stands for JavaScript Object Notation. It's not another language and it's even not a data container like yaml or xml are. JSON could be used as a data container if there's no function (or in this case we should say method) inside a JSON object, but it's not the primary goal of JSON :-)
var myJSObject = {
attr: {foo: "bar", baz: ["quux", "truc", "pouet"]},
fooAlert: function (num) {
alert(this.attr.foo+' '+num);
}
};
myJSObject.fooAlert(42);
p4bl0
2009-01-14 14:45:25
To be exact, the example you provided ain't JSON but the JavaScript object literal, which is similar but different.
Török Gábor
2009-04-17 23:44:25
I can only get espresso-mode to work with legal Javascript syntax. JSON expressions don't, for example, get indented properly.
ESV
2010-02-05 04:51:17