I've been all around this one. I can and often do save both XML and JSON versions of RSS and OPML. Truth is almost no one uses the JSON versions. The reason is simple. If you already have support for the XML version, what's gained by adding support for JSON? And everyone has to support the XML version, because HTML, RSS and OPML are all out there only in the XML format, for all practical purposes. #
Now, to the supposed advantages of JSON over XML.#
JSON is supposedly more readable than XML, but if you look at what people actually put on the wire, it's not true. There are no rules about whitespace, tabs, newlines, spaces in either format. Developers save files without including whitespace, thinking this makes their apps more efficient, when any gain has to be miniscule, esp with compression. It's bad engineering not to try to make your data files readable, imho, but it's also the default practice.#
JSON is supposed to be easier to process, but that also is not true. First you have to support the XML versions because that's what's out there. So even if it were monumentally more difficult, you can't avoid supporting XML formatted data in your code. Adding a second version makes your code more complex not simpler. #
If your development runtime doesn't have a package to serialize and deserialize XML as easily as JSON.parse and JSON.stringify, then do a good deed for your fellow developers, write it and release it as open source. That's a simpler and more ecologically sound way of alleviating any angst about XML. #
The old famous programming adage applies -- if it ain't broke don't fix it. XML works. It doesn't matter to users if you use XML or JSON. If you want to make the world a friendlier place, use indentation and newlines in your data. Either XML or JSON can be readable if you put in a little effort. #
You know those obnoxious sites that pop up dialogs when they think you're about to leave, asking you to subscribe to their email newsletter? Well that won't do for Scripting News readers who are a discerning lot, very loyal, but that wouldn't last long if I did rude stuff like that. So here I am at the bottom of the page quietly encouraging you to sign up for the nightly email. It's got everything from the previous day on Scripting, plus the contents of the linkblog and who knows what else we'll get in there. People really love it. I wish I had done it sooner. And every email has an unsub link so if you want to get out, you can, easily -- no questions asked, and no follow-ups. Go ahead and do it, you won't be sorry! :-)