Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 909
Shri Avatar asked Apr 05 '12 09:04

Shri


People also ask

Is JSON faster to parse than XML?

JSON is faster because it is designed specifically for data interchange. JSON encoding is terse, which requires less bytes for transit. JSON parsers are less complex, which requires less processing time and memory overhead. XML is slower, because it is designed for a lot more than just data interchange.

Is JSON easier to parse?

JSON is a data interchange format that is easy to parse and generate. JSON is an extension of the syntax used to describe object data in JavaScript. Yet, it's not restricted to use with JavaScript.

Which XML parser is recommended for android?

Android provides three types of XML parsers which are DOM,SAX and XMLPullParser. Among all of them android recommend XMLPullParser because it is efficient and easy to use.

Why XML is more secure than JSON?

JSON has no display capabilities whereas XML offers the capability to display data. JSON is less secured whereas XML is more secure compared to JSON. JSON supports only UTF-8 encoding whereas XML supports various encoding formats.


1 Answers

JSON is best compare to XML

XML is not well suited to data-interchange

Simplicity

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.

Extensibility

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.

Interoperability

JSON has the same interoperability potential as XML.

Openness

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

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

But still it depends on the requirements!

like image 59
Mohammed Azharuddin Shaikh Avatar answered Nov 18 '22 05:11

Mohammed Azharuddin Shaikh