× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Thorbjorn asked a good question: what are the benchmarks between XML and JSON. And those are hard to come by, since people rarely write for both, and when they do (aka Google), the JSON is usually just a serialized version of the XML, so you don't get a good comparison.

There are really two measures of performance, I think: message size and processing cycles. Represent an arbitrary record in JSON is pretty efficient:

[ "customerid" : 1123454, "name" : "Joe Pluta", "email" : "junkmail@xxxxxxxxxxxxxxxxx" ]

The XML is not much worse:

<customer customerid = 1123454 name = "Joe Pluta" email="junkmail@xxxxxxxxxxxxxxxxx" />

This of course assumes that you use attributes rather than children. Children make XML blow up like a balloon:

<customer>
<customerid>1123454</customerid>
<name>Joe Pluta</name>
<email>junkmail@xxxxxxxxxxxxxxxxx</email>
</customer>

Obviously the second version is efficiency challenged, although you'll see a lot of it because it's easier to program and easier to create the WSDL.

Where it gets interesting is when you want to send plain data. I can send an array of strings like this:

[ "ID01", "ID02", "ID03" ]

That's it. I send that and the application on the other side can translate it right back to an array of strings. Nothing to it. I'm not sure what the XML equivalent is.

I've also read that the stricter nature of JSON means that it processes more quickly. I don't have numbers to back that up, though.

And that's just JSON vs XML. It gets much worse with SOAP. SOAP messages are hugely overblown, requiring hundreds of extra bytes just to send a simple message. But there's no silver bullet - neither JSON nor XML is perfect for everything. SOAP is better in a distributed environment where clients and servers are widely separate, not nly geographically but programmatically: if one company wants data from another company, SOAP is often a better fit, the same way that EDI is a better fit than a flat file.

On the other hand, if you're writing a multi-tiered application and you want to speak between tiers, JSON is probably the best representational language. Of course, hardcoded binary data structures are even faster, so once again, there's no single answer. But with JSON the messages are a lot easier to verify.

Joe


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.