Why XML instead of JSON?

Started by axefrog, May 13, 2015, 10:26:43 PM

Previous topic - Next topic

axefrog

Hey Tynan, why'd you go with XML over JSON? XML is so... verbose... and... 10 years ago! ;)

<SerializationFormats>
    <XML><Bloated /></XML>
    <JSON><Clean /></XML>
</SerializationFormats>

{
    XML: 'Bloated',
    JSON: 'Clean'
}

Tynan

#1
The real reason is that XML was already supported by the .NET framework and Visual Studio.

And it's not much 'dirtier' IMO. It's less concise, but the <> tags are clean compared with spewing quotations, colons, commas, and curly braces everywhere.

It wouldn't be impossible to write a content loader that could take either. I just haven't had any reason to. XML works just fine and with a decent editor it's not hard to edit at all.

You can see this in the examples, when they're actually written properly with equivalent data:


<SerializationFormats>
    <XML>Long but clean</XML>
    <JSON>Concise but dirty</JSON>
</SerializationFormats>

"SerializationFormats":{
    "XML": "Long but clean",
    "JSON": "Concise but dirty"
}
Tynan Sylvester - @TynanSylvester - Tynan's Blog

converging

[SerializationFormats]
XML=Long but clean
JSON=Concise but dirty
IniFile=Timeless

Latta

And JSON would make modding harder for those who are not friendly with programming, at least JSON itself.
It's easy to not add quote, colon, (especially) comma by a mistake if one's not used to. XML is so, verbose, that it is easier.
Well I'm not a fan of all those closing tags and such, but modern editors support auto-closing and multi editing("select next occurence"), even free ones like Atom.

axefrog

Fair enough. Was just curious is all. I'll arm wrestle you over your assertion that XML is cleaner though.

Tynan

Well, I'm super used to it now.
Tynan Sylvester - @TynanSylvester - Tynan's Blog

Shinzy

Quote from: converging on May 13, 2015, 11:43:08 PM
IniFile=Timeless

Ooohh ini files!
Those things made me feel genious when I finally realized I could by editing those change textures of a specific level without overriding the base textures for all the other levels in one freeware top down shooting game ;D *tear*

Mystic

I've got to side with Tynan on this. I work with both XML and JSON in my job, and I still prefer XML for a number of reasons (some of which, like XSLT and Xpath, don't really apply here). IMO, JSON's main advantages surface when transferring data over the Internets and to/from browsers, which also isn't happening here.

StorymasterQ

I know, Registry Entries!

F*** the non-Windows users!
Bloat the Registry and F*** the Windows users too!
I like how this game can result in quotes that would be quite unnerving when said in public, out of context. - Myself

The dubious quotes list is now public. See it here

rexx1888

let the mud slinging commence lol

As a designer, i couldnt give a toss as long as it works. My programmer on the other hand has lots to say on the subject, an it mainly boils down to "xml is gross" lol.

b0rsuk

XML is like violence. If it doesn't work, you need to use more.

Rahjital


ZestyLemons

Help out with the wiki!

Steam: http://steamcommunity.com/id/Divaya/
Wiki: http://rimworldwiki.com/wiki/User:Zesty

Feel free to contact me about wiki questions or wiki admin stuff.

psilous

such a really interesting question and answer. Thanks!

iuiz

Quote from: axefrog on May 13, 2015, 10:26:43 PM
Hey Tynan, why'd you go with XML over JSON? XML is so... verbose... and... 10 years ago! ;)

<SerializationFormats>
    <XML><Bloated /></XML>
    <JSON><Clean /></XML>
</SerializationFormats>

{
    XML: 'Bloated',
    JSON: 'Clean'
}

Your comparison is kinda polemic and shows to me, that you want to try to compare apples and oranges. XML is a wide technology stack that offers a huge range of features like defining own datatypes, keywords or transformations (look into XSLT for example). It is also easier to define your own domain specific language with XML, which is something that you want in so many cases, when the complexity of your format expands and you work with lots of developers (for example 20 or more).

You can also add comments to your files and it is easily readable by humans. I mean humans can read JSON too, but in big documents, where you implement against a big DTD or something, XML is in my opinion most of the times the better format.

That you stated that it is 10 years old should never be an reason to not use it. At the time when XML came up there were several other formats, that were kinda used everywhere. Take EDIFACT as an example. However XML works so well, that it became king of the human readable formats in no time.

However JSON is also a great format and can be used nearly as often as XML. In my opinion If you want a format for data interchange within your own system landscape AND you write it from hand from time to time or need a not expensive to develop format JSON works great. JSON is the little lightweight brother of XML. It is great, but simply does not offer the same feature set.