Subject: [domainrep] xml versus json

From: Steve Allam <[email-masked]>
Date: Fri, 23 Mar 2012 08:15:00 +0000

All,

I have been looking at implementing the repute framework in our 
application, and was exploring the JSON v. XML issue internally.  We 
already supply answers to queries in three formats:

- use of HTTP response code (ooh, nasty hack, but really quick)
- XML
- plain text

Digging back, we used XML because, well, it was there, it was used by 
various standards, we wanted to have a standards based API, SOAP/XML 
like - partly because when you talk to integrators, you can say - 'we 
have a proprietary API', or you can say 'we use SOAP/XML' and the latter 
phrase seems to calm people.

However, whilst we return XML, we don't POST xml as part of the query 
(too slow), we use GET params, so we use a dirty form of soap :-)

In fact, in all the connectors we write, we make use of the plain text 
format the most - none use the XML format.  The problem was, we defined 
the XML as a comprehensive response, and the text one as a minimal 
response, but with scope creep, the text one got longer.

Given our experiences, I would thus tend more towards JSON - SOAP/XML 
works well as a 'standard', but JSON works equally well and in my 
experience is much quicker to parse than XML (certainly if you use 
drop-in libraries).

XML gives the benefit of a schema however, closely defining your doc, 
whereas JSON can be much less well defined,- however, the JSON spec is a 
one pager (I'd not looked at json.org before - I liked it a lot), so as 
long as the vocab definitions have a clear indication of how the JSON is 
formed, I think it could be the winner?

Regards,

Steve

-- 
*
Steve Allam | * Chief Technology Officer *| TrustSphere *

3 Phillip Street, #13-03 Commerce Point, Singapore, 048693
Tel: +65 6536 5203 | Fax: +65 6536 5463
[email-masked] | www.trustsphere.com

---

From: "Murray S. Kucherawy" <[email-masked]>
Date: Sat, 24 Mar 2012 21:18:57 +0000

> From: [email-masked] [mailto:[email-masked]] On Behalf Of Steve Allam
> Sent: Friday, March 23, 2012 1:15 AM
> To: [email-masked]
> Subject: [domainrep] xml versus json
> 
> However, whilst we return XML, we don't POST xml as part of the query (too slow), we use GET params, so we use
> a dirty form of soap :-)

This lines up nicely with the query mechanism we've proposed here.  Yay!

> Given our experiences, I would thus tend more towards JSON - SOAP/XML works well as a 'standard', but JSON
> works equally well and in my experience is much quicker to parse than XML (certainly if you use drop-in
> libraries).
> 
> XML gives the benefit of a schema however, closely defining your doc, whereas JSON can be much less well
> defined,- however, the JSON spec is a one pager (I'd not looked at json.org before - I liked it a lot), so as
> long as the vocab definitions have a clear indication of how the JSON is formed, I think it could be the
> winner?

It's been said lately that XML isn't all that useful for client-server software, but rather for editors to provide smart formatting.  Clients and servers will do their own validation of the content, so the availability of a schema doesn't help us that much.  I'm less expert in such matters than others, but I know that both my XML and JSON implementations do their own checking of required content and syntax rather than relying on the schema.  Instead, the schema guides the code I write.

-MSK

---

From: Steve Allam <[email-masked]>
Date: Sun, 25 Mar 2012 21:46:57 +0100

Murray,

I note that there is a JSON schema (expired) draft ietf document here:
    http://tools.ietf.org/html/draft-zyp-json-schema-03

  - just to make a simple thing more complicated....

Regards,

Steve

On 24/03/2012 9:18 PM, Murray S. Kucherawy wrote:
> _______________________________________________
> domainrep mailing list
> [email-masked]
> https://www.ietf.org/mailman/listinfo/domainrep

---

From: Roland Turner <[email-masked]>
Date: Mon, 26 Mar 2012 20:46:51 +0800

On 25/03/2012 05:18, Murray S. Kucherawy wrote:

> It's been said lately that XML isn't all that useful for client-server software, but rather for editors to provide smart formatting.

I saw a comment to this effect after your recent implementation 
comparison and I've chewed it over for a while. I'm starting to lean 
towards JSON is a better choice than XML is for communicating data 
structures, in particular because of the mess around dealing with 
whitespace in XML, itself a consequence of XML being a text mark-up 
language rather than a data structure representation one. (There are 
correct solutions of course, but converging on them takes time; JSON 
avoids this problem entirely, not merely because the libraries are newer 
but because it's not built as marked-up text to begin with.)

- Roland