Page 1 of 1

JSON vs. XML

Posted: Tue Aug 05, 2014 6:23 pm
by Verahta
This came up in another thread and I thought it might deserve it's own thread. What are your own opinions on JSON vs XML? He is probably biased, but the 'creator' of JSON explains in this short interview why it's better than XML (at least in his opinion, though he does give tangible reasons).

Discovering JavaScript Object Notation with Douglas Crockford
https://www.youtube.com/watch?v=kc8BAR7SHJI

Re: JSON vs. XML

Posted: Tue Aug 05, 2014 8:50 pm
by Jackolantern
JSON is, for the most part, a better choice. It is more readable and compact. Plus, with the increasing popularity and ubiquity of Javascript, the fact that JS can natively consume JSON data without any library or translation required is quite handy.

For any online game, the compactness of JSON data can end up being a huge bandwidth saving when you look at a whole month at a time.

Re: JSON vs. XML

Posted: Tue Aug 05, 2014 9:28 pm
by Chris
JSON is very simpe and straight foreward, you cannot define relations to parts of data. XML can be used for small scale (preferably not) to very large complex relational structures.

It's like comparing procedural code with asynchronous. Or comparing classical mechanics with Quantum mechanics.

Re: JSON vs. XML

Posted: Tue Aug 05, 2014 9:32 pm
by Jackolantern
JSON can represent relations. To my knowledge, XML cannot represent anything that JSON cannot also represent. They are both just different ways of representing data's structure.

Re: JSON vs. XML

Posted: Tue Aug 05, 2014 9:34 pm
by Chris
Jackolantern wrote:JSON can represent relations. To my knowledge, XML cannot represent anything that JSON cannot also represent. They are both just different ways of representing data's structure.
the whole benefit of XML is not only being able to place data withing the tag, but also adding parameters:

Code: Select all

<entity parameter="property value"><secondaryEntity /></entity>
To achieve this with JSON would be rather difficult as you only store lists of data or singularity data.

Re: JSON vs. XML

Posted: Tue Aug 05, 2014 9:46 pm
by kaos78414
Chris wrote:
Jackolantern wrote:JSON can represent relations. To my knowledge, XML cannot represent anything that JSON cannot also represent. They are both just different ways of representing data's structure.
the whole benefit of XML is not only being able to place data withing the tag, but also adding parameters:

Code: Select all

<entity parameter="property value"><secondaryEntity /></entity>
To achieve this with JSON would be rather difficult as you only store lists of data or singularity data.
Why wouldn't this suffice?

Code: Select all

{ "entity": { "parameter":"property value", "secondaryEntity": { } } }

Re: JSON vs. XML

Posted: Tue Aug 05, 2014 9:52 pm
by Chris
That could be processed to the same result but it took three objects instead of two. The way I look at it is in two directions. XML can go both, JSON can only go in one.

Like RNA and DNA.

Try developing a Windows 8 App with XAML, you'll come to terms with it.

Re: JSON vs. XML

Posted: Tue Aug 05, 2014 10:42 pm
by Verahta

Re: JSON vs. XML

Posted: Tue Aug 05, 2014 10:57 pm
by Jackolantern
XML is a better fit to me for UI-related work, such as XAML or Android UI. So I will definitely give XML that. Comparable UI systems made with JSON (and there are only a couple I know of) just feel clunky and foreign. I don't know if this actually has anything to do with its abilities, or just that XML feels like HTML.

However, I much prefer JSON for actual data transfer.

Re: JSON vs. XML

Posted: Tue Aug 05, 2014 11:04 pm
by Chris
"XML is like violence. If it doesn't solve your problem, you're not using enough of it."
- Unknown | Chris Maden
I lol'd