Home » Android » which is better in terms of parsing performance in Android, XML or JSON?

which is better in terms of parsing performance in Android, XML or JSON?

Posted by: admin June 15, 2020 Leave a comment


I am new to android development

What should I use for my Android application, XML or JSON?

Which is better in terms of parsing performance?

I would appreciate any sample code.

How to&Answers:

JSON is best compare to XML

XML is not well suited to data-interchange


XML is simpler than SGML, but JSON is much simpler than XML. JSON has a much smaller grammar and maps more directly onto the data structures used in modern programming languages.


JSON is not extensible because it does not need to be. JSON is not a document markup language, so it is not necessary to define new tags or attributes to represent data in it.


JSON has the same interoperability potential as XML.


JSON is at least as open as XML, perhaps more so because it is not in the center of corporate/political standardization struggles.

Since JSON syntax requires fewer characters, it is lighter on the wire than XML.

But still it depends on the requirements!


Few questions on something similar have been asked before: What's better: Json or XML (PHP) They do explain which is faster and which is not.

You can always use Google-GSON, which makes parsing JSON(irrespective of how large the data set is) real fast. I personally prefer JSON rather than XML as it is easier for data exchange even though readability is hampered.


Based on experience, parsing XML can be bothersome on Android 2.1 and earlier due to a bug which breaks encoded entities into separate tags (http://code.google.com/p/android/issues/detail?id=2607).

Personally, I find JSON parsing to be more convenient. Take a look at the following link: http://www.technotalkative.com/android-json-parsing/


JSON is better than XML if data size is not too much large.
So that, GSON which is developed with help of JSON api is better, because it is easy to handle.
But JSON has one major disadvantage, that is –
the data is loaded into memory and then parse. If data size is being too much large, it will through an exception.
In that case – XML is very useful.
JSON is better because it is faster than XML(because hashing is used)


The only benefit of XML is that it is more “Human readable”…but seeing that the end user is not going to be reading the XML, there is no need to use it.

JSON is much easier / faster to parse than XML