Serialization Languages
Serialization languages have their fashions. XML used to be big as in popular, then it got big as in overengineered, and then it fell into the hands of âEnterprise Information Architectsâ and itâs not been seen alive since. Todayâs XML is the epitome of âsomewhere in that mess is a small, elegant language trying to escape.â
Still, XML was way, way better than its predecessors, which included such monsters as the Standard Generalized Markup Language (SGML), which in turn were a cool breeze compared to mind-torturing beasts like EDIFACT. So, the history of serialization languages seems to be one of gradually emerging sanity, hidden by waves of revolting EIAs doing their best to hold onto their jobs.
JSON popped out of the JavaScript world as a quick-and-dirty âIâd rather resign than use XML hereâ way to throw data onto the wire and get it back again. JSON is just minimal XML expressed, sneakily, as JavaScript source code.
Hereâs a simple example of using JSON in a Cheap protocol:
"protocol": { "name": "MTL", "version": 1 }, "virtual-host": "test-env"
The same example in XML would be (XML forces us to invent a single top-level entity):
<command> <protocol name = "MTL" version = "1" /> <virtual-host>test-env</virtual-host> </command>
And using plain-old HTTP-style headers:
Protocol: MTL/1.0 Virtual-host: test-env
These are all pretty equivalent, so as long as you donât go overboard with validating parsers, schemas, and other âtrust us, this is ...
Get ZeroMQ now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.