19 down vote accepted
Borrowing a JSON sample from Wikipedia, a JSON representation of a person might look like:
What is XML?XML (eXtensible Markup Language)
Again borrowing a XML sample from Wikipedia, an XML representation of a person might look like:
ComparisonBased on these simple definitions, it's understandable that one could conclude that JSON and XML are comparable. If your goal is to use one or the other for simple data interchange over the Internet,
as exhibited by the simple examples above, that goal is surely attainable and JSON and XML are, indeed, mostly comparable.
However, as you dig deeper into the specifications of each you begin to realize they are completely different standards with similar goals; each with overlapping use cases where one is much better
suited than the other and where they are equivalent solutions (where the choice is a matter of the specific use case).
Though it may be just a bit biased,
lists some good points of comparison. There are also the