Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I've seen a lot of XML vs. JSON discussion that misses the point why developers like me love JSON so much, at least until things get really big, or you want to add another 9 to your reliability [1].

JSON is so easy to get started with. Some of this is precisely because of the lack of schema.

In Java with the GSON library, encoding/decoding is one function call and for the things I've been doing this just works at least 90% of the time. I've managed to add a JSON option to several endpoints in an application in something like 1-2 hours, including writing tests.

Back when I did Java as a full-time job and we were working with XML a lot, there were whole proccesses and workflows and validations and annotations to get the thing working properly. I think you also had to add a few extra stages to the maven compile process back then to get the schemas and all properly set up and loaded. It's not so much a fault of XML as a format, as of the whole "enterprise" tooling that we were asked to use around it. I really hope that this has got easier now.

It's almost as if the XML library people were thinking in the waterfall model where you specify everything up front, and the GSON people were thinking in the agile model.

[1] https://rachelbythebay.com/w/2019/07/21/reliability/



Using GSON is great if you're encoding/decoding straightforward data structures. However if you're using it for serialization for more complicated objects (especially with polymorphism!) it gets zany really quickly.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: