File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes JSON vs XML Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "JSON vs XML" Watch "JSON vs XML" New topic


Anu Bhagat
Ranch Hand

Joined: Jun 20, 2008
Posts: 64
I am trying to make a decision for data transfer appraoch in a java application.
I am not sure if I should use JSON or XML.
Any comments will be useful.

Thanks in advance.

Anu Bhagat

Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
"In" a Java application? What are the two ends of the transfer?
Vishal Shaw
Ranch Hand

Joined: Aug 09, 2012
Posts: 179

I think this might help you


Programming is about thinking, NOT coding
kourosh parsa
Ranch Hand

Joined: Jan 22, 2012
Posts: 35
xml has a definition file which can be used to validate that your tags are correct.
Both the formats are well supported for parsing so I guess you can go with which ever, although in the industry, xml is often favored.
Marcos Vidolin

Joined: May 10, 2011
Posts: 28
The approach will depend on what you want. In general I have used JSON because it's smaller and more readable than XML.
Just for note, Twitter and Foursquare left XML and started using exclusively JSON.

The following code snippets represents the same data:


I agree. Here's the link:
subject: JSON vs XML
jQuery in Action, 3rd edition