UK Web Focus (Brian Kelly)

Innovation and best practices for the Web

Moves Away From XML to JSON?

Posted by Brian Kelly on 26 Nov 2010

Although in the past I have described standards developed by the W3C which have failed to set the marketplace alight I have always regarded XML as a successful example of a W3C standard.  Part of its initial success was its simplicity – I recall hearing the story of when XML 1.0 was first published, with a copy of the spec being thrown into the audience to much laughter. The reason for the audience’s response? The 10 page (?) spec fluttered gently towards the audience but the SGML specification, for which XML provided a lightweight and Web-friendly alternative, would have crushed people sitting in the first few rows!   I don’t know whether this story is actually true but it provided a vivid way of communicating the simplicity of the standard which, it was felt, would be important in ensuring the standard would gain momentum and widespread adoption.

But where are we now, 12 years after the XML 1.0 specification was published? Has XML been successful in providing a universal markup language for use in not only a variety of document formats but also in protocols?

The answer to this question is, I feel, no longer as clear as it used to be.  In a post on the Digital Bazaaar blog entitled Web Services: JSON vs XML Manu Sporny, Digital Bazaar’s Founder and CEO, makes the case for the ‘inherent simplicity of JSON, arguing that:

XML is more complex than necessary for Web Services. By default, XML requires you to use complex features that many Web Services do not need to be successful.

The context to discussions in the blogosphere over XML vs JSON is the news that Twitter and Foursquare have recently removed XML support from their Web APIs and now support only JSON.  James Clark, in a post on XML vs the Web, appears somewhat ambivalent about this debate (“my reaction to JSON is a combination of ‘Yay’ and ‘Sigh‘”) but goes on to list many advantages of JSON over XML in a Web context:

… for important use cases JSON is dramatically better than XML. In particular, JSON shines as a programming language-independent representation of typical programming language data structures.  This is an incredibly important use case and it would be hard to overstate how appallingly bad XML is for this.

The post concludes:

So what’s the way forward? I think the Web community has spoken, and it’s clear that what it wants is HTML5, JavaScript and JSON. XML isn’t going away but I see it being less and less a Web technology; it won’t be something that you send over the wire on the public Web, but just one of many technologies that are used on the server to manage and generate what you do send over the wire.

The debate continues on both of these blogs.  But rather than engaging in the finer points of the debates of the merits of these two approaches I feel it is important to be aware of decisions which have already been taken.   And as Manu Sporny has pointed out:

Twitter and Foursquare had already spent the development effort to build out their XML Web Services, people weren’t using them, so they decided to remove them.

Meanwhile in a post on Deprecating XML Norman Walsh responds with the comment “Meh” -though he more helpfully expands in this reaction by concluding:

I’ll continue to model the full and rich complexity of data that crosses my path with XML, and bring a broad arsenal of powerful tools to bear when I need to process it, easily and efficiently extracting value from all of its richness. I’ll send JSON to the browser when it’s convenient and I’ll map the the output of JSON web APIs into XML when it’s convenient.

Is this a pragmatic approach which would be shared by developers in the JISC community, I wonder? Indeed on Twitter Tony Hirst has just askedCould a move to json make Linked Data more palatable to developers?” and encouraged the #jiscri and #devcsi communities to read a draft document on “JSON-LD – Linked Data Expression in JSON“.

9 Responses to “Moves Away From XML to JSON?”

  1. […] This post was mentioned on Twitter by Mike Parsons, Brian Kelly. Brian Kelly said: Moves Away From XML to JSON?: Although in the past I have described standards developed by the W3C which have fa… […]

  2. XML is a simple markup language, not much harder to grasp than HTML – the complexity lies in the application of it.So, its not XML syntax that makes RDF a complex schema to fully understand, but the W3C schema itself. That said, I think the json / xml conundrum is something of a false one when it is now commonplace to use RESTful APIs that can return data in the developer’s preferred format

  3. Hi Brian,

    Nice post. I can see the simplicity that JSON gives for a lot of web services, but if we see more of a move towards linked data and semantic web applications it’ll be less appropriate. I suspect we’ll see more of the latter, although perhaps only behind the scenes.

    — Simon

  4. I really hate the fact that there’s some xml-like annoyances in RDF which stop it being really easy to do in JSON nicely.

    Basically, it’s all around the ‘object’ (the 3rd part of the triple). It can be a URI, a typed literal, an untyped literal or a language coded literal (why isn’t a string literal in french just a kind of bloody datatype?)

    The JSON RDF formats just don’t ‘feel’ right yet…

  5. melkinny360 said

    22 Dec 2010 … I believe than XML (and its associated technologies) will end up as an … I expect it to move again, away from JSON and towards DSL.

  6. melkinny360 said

    If you are going to move away from XML, I would suggest skipping the intermediate stage of JSON, and moving all the way to YAML.

  7. melkinny360 said

    1 Dec 2010 … The API will support XML and JSON for both input and output formats. … Most modern browsers will strip your XML tags away, … The code is numbered down the right side, and I’ll reference each as I move along.

  8. melkinny360 said

    3 Dec 2010 … First, Manu Sporny talked about the move to JSON being more of a paradigm …. or a PDF, or display it in a table control in a rich client app. … to be conformant XML, so that the differences will finally go away.

  9. melkinny360 said

    Out of the box, we are planning to support xml, json and OData however we’re ….. developers to move away from static calls which are difficult to test.

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: