I’ve written several posts on JSON, most recently here and here. These last two posts considered the advantages of JSON over S-expressions for writing log files. Although S-expressions are more powerful and flexible than JSON, as explained in the 7-part series referenced in the Writing Log Files In JSON post, I concluded that JSON might, nevertheless, be the right answer because there are tools available for working with JSON in almost every language, whereas S-expressions, with a few exceptions, are most naturally handled with some flavor of Lisp.
Now, a post on the SHiNKiROU Blog entitle S-Expressions: The Fat-Free Alternative to JSON is giving me second thoughts. The context of the post is a bit larger than log files and includes such things as document markups. JSON is certainly a win over XML for key-value-pairs, the post says, but not so good for things like HTML markup. S-expressions, on the other hand, can do both jobs equally well. Chapter 16 Paul Graham’s ANSI Common LISP, for example, describes a set of functions for turning S-expressions into HTML.
I find the post pretty persuasive although I do still worry about non-Lispers being comfortable with sexprs or at least being able to do useful things with them right off the bat. Say what you will about JSON, it’s very easy to learn just about everything you need to know about them—excluding the various tools that work on them, of course. S-expressions are pretty easy too but I don’t think there are as many (non-Lisp) tools available to work with them. Much as I would like everyone to learn a bit of Lisp, we all know that’s not going to happen so where does that leave us? Should we use the more powerful and simple S-expressions, or should be use JSON because of its multi-language support? What do you think?