Skip to content
Advertisement

Performance considerations of JSON vs. XML

I am using a webservice which provides a large result set either in XML or JSON format.
Which format will be faster or better (perfomance based)? Also which language should I use to parse the XML/JSON? Should I use PHP or JavaScript?

Advertisement

Answer

“PHP or JavaScript” sounds like an odd choice to offer: PHP is usually used as a server-side language, whereas JavaScript is usually used as a client-side language.

What’s your situation? What makes you suggest those two languages in particular? If you could give more information about what you’re trying to do, that would help a lot. (We don’t know whether you’re developing a web app, a batch processing tool, a GUI application, etc.)

I suspect JSON will be a bit more compact than XML, although if they’re compressing the data you may well find they end up taking the same bandwith (as a lot of the “bloat” of XML is easily compressible).

As ever, the best way to find out is to test the specific web service with some realistic data. Generalities aren’t a good basis for decision-making.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement