Last night I came up with a grand plan to create a JS HTML serializer so I could create JSON representations of HTML markup. My goal was to completely do away with creating HTML markup via DOM or string building, relying instead on standardized JSON formatted objects and some parser functions to convert them to and from HTML.

Well, turns out it’s already done – at least in the abstract. Rats. All my good ideas are other people’s.
http://jsonml.org/

I’m going to do a little more digging, but a Prototype/jQuery extension to generate HTML markup based on that format seems like a real no-brainer. It could seriously reduce code clutter, plus it would abstract away the actual node creation into a library that could handle it in a way that’s most efficient for the JS framework being used.

IBM wrote an article on it way back in July 2007, which is worth a read:
http://www.ibm.com/developerworks/library/x-jsonml/

Neat stuff! I’ll certainly investigate it for future DHTML work.