Jump to content

Question about XML [devs]


themirror

Recommended Posts

Hello guys.

I'm a C# developer and I am really curious to know why the decision to use XML files instead of JSON files.

It is a unity default or what?

 

JSON has many advantages over XML, in parsing time, generic arrays, etc.

Since the 5.3.3 Unity update, there is a native parser for JSON that is way better than other 3rd party JSON parsers. There is any plans to change XML files to JSON files?

 

Any other developers can see the whole purpose of using XML over JSON? Any noticeable advantages?

Link to comment
Share on other sites

I also develop with unity... among other things. I think they went with XML for simplicity, it's a lot easier for n00bs to read XML.

 

JSON is also very unforgiving whereas with XML everything can pretty much be parsed individually so a single typo won't render the entire file unreadable.

 

XML is also easier to extend than JSON.

 

Personally I have a strong dislike for XML having used it many times before and given the choice I'd be using JSON but I can also see where in this case XML has certain advantages over JSON.

Link to comment
Share on other sites

On a small dev team, the choice between two similar approaches is most likely due to the preferences of whoever is doing the work.

 

I will say that there are some very good tools for working in XML, and being able to do schema validation on files that your users may be editing is probably a good thing. I don't know if there's a way to do that in JSON. It might also be handy to be able to use XQuery/XPath in the code; again, I don't know if there's a similar feature if you use JSON.

Link to comment
Share on other sites

Guest Rust Buddy
Hello guys.

I'm a C# developer and I am really curious to know why the decision to use XML files instead of JSON files.

 

 

I suggested it. Done deal.

Link to comment
Share on other sites

I think many people who delve into the config files to change and tweak things are probably happy it's XML and not JSON files, simply as it's more straightforward and easy to read in my view. Though some claim JSON is easier to read :p

 

Things like efficiency and parsing times wouldn't be a big issue anyways, it's loaded once, then used, and not continually accessed I believe. At this point in time, switching over from XML to JSON would be pointless unless there was a particular things which XML wasn't allowing which was needed. Doing it just because a unity version (later than initial design) happened to have better support for it, if it didn't actually make any change to how the game runs, also wouldn't make sense.

 

JSON also doesn't allow for commenting the files, something which XML does no?. Well, normally anyways, I guess you could strip it, but then it's not really JSON is it. That's extremely helpful in XML files which users will be editing.

 

/V :)

Link to comment
Share on other sites

While I fall strongly into the "avoid XML like the plague" camp and I love JSON overall, I think something in the middle (YAML or perhaps JSON5) would be my preference if I was involved in the dev side of a project like this. Though I have no idea how Unity deals with any of it (I can't yet get my work to pay me to work with Unity :smile-new: ).

 

That said, I hold my breath and work in the XML because I love this game enough to deal with even it's wartiest warts when I'm modding.

Link to comment
Share on other sites

While I fall strongly into the "avoid XML like the plague" camp and I love JSON overall, I think something in the middle (YAML or perhaps JSON5) would be my preference if I was involved in the dev side of a project like this. Though I have no idea how Unity deals with any of it (I can't yet get my work to pay me to work with Unity :smile-new: ).

 

That said, I hold my breath and work in the XML because I love this game enough to deal with even it's wartiest warts when I'm modding.

 

You can usually find a library you can incorporate into your project although since unity uses an ancient version of mono sometimes you have to fix and recompile the library to do so.

Link to comment
Share on other sites

It's more an issue of accessibility.

Not all developers (or modders) are programmers or even numbers persons.

 

Up until A16 XML was used exclusively to store content data and there it makes no difference whatsoever.

A17 has "scripting" in XML (Down boys! It's a handful of simple logic functions and conditions) but we're moving towards beta and redoing the declaration of every bit of content over a preference... nope.

Link to comment
Share on other sites

It's more an issue of accessibility.

Not all developers (or modders) are programmers or even numbers persons.

 

Up until A16 XML was used exclusively to store content data and there it makes no difference whatsoever.

A17 has "scripting" in XML (Down boys! It's a handful of simple logic functions and conditions) but we're moving towards beta and redoing the declaration of every bit of content over a preference... nope.

 

Damn you!

 

That's like telling someone you have cake without telling them it's "carrot" cake. :-)

 

On a more serious note, it'll be interesting to see how that's implemented.

Link to comment
Share on other sites

Damn you!

 

That's like telling someone you have cake without telling them it's "carrot" cake. :-)

 

On a more serious note, it'll be interesting to see how that's implemented.

 

"carrot cake" with chocolate is a thing on brazil

 

bolo-de-cenoura-zero-com-cobertura-de-chocolate.jpg.a72510d23237b2e2cb309ac801b76817.jpg

 

I'm pretty curious about "scripts" in XML on A17

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...