themirror Posted April 13, 2018 Share Posted April 13, 2018 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 More sharing options...
The Gronk Posted April 13, 2018 Share Posted April 13, 2018 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 More sharing options...
Tin Posted April 13, 2018 Share Posted April 13, 2018 This ^ If you feel the need to do more like, writing scripts, add assets or just go deeper check out sdx for your needs. Does a pretty decent job. Link to comment Share on other sites More sharing options...
ColdSteelRain Posted April 14, 2018 Share Posted April 14, 2018 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 More sharing options...
Guest Rust Buddy Posted April 14, 2018 Share Posted April 14, 2018 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 More sharing options...
Vedui Posted April 14, 2018 Share Posted April 14, 2018 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 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 More sharing options...
Amanda Posted April 14, 2018 Share Posted April 14, 2018 I suggested it. Done deal. Hey, I am beginner level developer, I thought the same things even still now. Can you please tell me what your suggestion regards this issue? Glad if you. Link to comment Share on other sites More sharing options...
Qyzer Posted April 14, 2018 Share Posted April 14, 2018 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 ). 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 More sharing options...
The Gronk Posted April 14, 2018 Share Posted April 14, 2018 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 ). 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 More sharing options...
themirror Posted April 17, 2018 Author Share Posted April 17, 2018 Thanks for the answers guys, sorry for the delay to reply. Link to comment Share on other sites More sharing options...
StompyNZ Posted April 18, 2018 Share Posted April 18, 2018 json is better for data transfer, xml is better for manually editing Link to comment Share on other sites More sharing options...
Gazz Posted April 18, 2018 Share Posted April 18, 2018 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 More sharing options...
themirror Posted April 18, 2018 Author Share Posted April 18, 2018 Thanks for the reply @Gazz Link to comment Share on other sites More sharing options...
The Gronk Posted April 18, 2018 Share Posted April 18, 2018 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 More sharing options...
Gamida Posted April 18, 2018 Share Posted April 18, 2018 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. I actually like carrot cake. Link to comment Share on other sites More sharing options...
Guppycur Posted April 18, 2018 Share Posted April 18, 2018 Then you would be pissed at Rosanne. Link to comment Share on other sites More sharing options...
Gazz Posted April 19, 2018 Share Posted April 19, 2018 Cake settles any argument. Link to comment Share on other sites More sharing options...
SylenThunder Posted April 19, 2018 Share Posted April 19, 2018 The cake is a lie... Link to comment Share on other sites More sharing options...
Gamida Posted April 19, 2018 Share Posted April 19, 2018 Then you would be pissed at Rosanne. I saw.... Link to comment Share on other sites More sharing options...
themirror Posted April 19, 2018 Author Share Posted April 19, 2018 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 I'm pretty curious about "scripts" in XML on A17 Link to comment Share on other sites More sharing options...
Spectral Force Posted April 19, 2018 Share Posted April 19, 2018 "carrot cake" with chocolate is a thing on brazil [ATTACH=CONFIG]24363[/ATTACH] I'm pretty curious about "scripts" in XML on A17 Guess we'll find out more when A17 releases or Gazz gives more insight. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.