After yesterday’s post on JSON Versus S-Expressions I thought that one obvious solution for people who want to use JSON tools to process logs is to have the (Lisp-based) logs convert themselves to JSON much like we did for S-expressions to XML. I thought about issuing another challenge to write Elisp code to do the conversion but it’s so similar to the Sexpr-to-XML example that I decided not to.
I’m pretty sure that I remember seeing Lisp code that converts JSON into Sexprs and vice versa so you could start with either Sexprs or JSON and easily convert to the other if that was more convenient. I think the code I saw was for either Scheme or CL so a good exercise would be to write Elisp code that converts JSON into Sexprs. That way you could work with JSON in Emacs.
Actually, that seemed like such a good idea that I thought someone must surely have done it and, of course, someone has. It’s even included with Emacs. Is there anything Emacs can’t do?