1. Home
  2. Blog posts
  3. The clash between XML and JSON

The clash between XML and JSON

By Jaishankar, Exeter Premedia

Freedom of choice can sometimes also result in great confusion especially when there are too many options to choose from. From choosing a dress to choosing a restaurant, what matters is the quality, quantity, cost, and accuracy of the product and service.

Likewise, whenever a new software project is started, there are a lot of technical questions that pop up. From which technology platform to use to that of databases and APIs, it’s a confusing call! 

XML or JSON – the never-ending comparison

When we want to store data in a structured way, both XML and JSON compete with each other. But the question that arises here is why is there a clash between the two? Probably because these are the most widely used formats.

Why should we use XML and JSON?

XML (eXtensible Markup Language) has been in use for many decades, has many ways to validate and follows a defined schema. It has helped in defining a process in a structured way for many companies and has streamlined their technologies. There is Xquery, Xpath that allows us to do a web search in:

  • Metadata applications

On the other hand, JSON (JavaScript Object Notation) is a structured syntax which is a key, value paired data. It can be parsed in almost all programming languages easily. There are a lot of databases that use JSON as their data structure in order to retrieve data at a great speed. It has gained popularity and attention in many areas. JSON is mostly used in:

  • Database
  • Configurations
  • Transferring data

As mentioned above, XML’s purpose is document markup, handling large and complex data. It gives semantic meaning to text through its tree-like structure and can represent mixed content. Having XML as your APIs response or as a configuration can be still done but that is not its purpose. JSON’s purpose is structured data interchange. It serves this purpose by directly representing objects, arrays, numbers, strings, and booleans. Its purpose is distinctly not document markup. Moreover, JSON does not have a natural way to represent mixed content.

Companies use XML or JSON for their APIs and some use both. Many desktop applications use XML only. Major databases which support XML (IBM DB2, Microsoft SQL Server, Oracle Database, PostgresQL, BaseX, eXistDB, MarkLogic, MySQL) and major databases that support JSON (MongoDB, CouchDB, eXistDB, Elasticsearch, BaseX, MarkLogic, OrientDB, Oracle Database, PostgresQL).

Which one would be the future?

XML is a document markup that serves schemas and DTD that in my opinion could be used in document creation, manipulation, and storage. It is still heavily used on the web for publishing needs and is considered as a source from which other markup formats (ePub/x-Html) are converted. There are a lot of new devices, products which have been developed in the Internet of Things that are smaller and less powerful than computers and will be in a need to exchange data across the web, the lighter and faster JSON would naturally be preferable to XML. Moreover, REST APIs, NoSQL databases, full-stack javascript, new methods of API development and with the increasing performance, JSON will be more widely used and would replace XML in the software development field. Whereas XML will continue strongly in serving the need for managing documents.

Updated on September 15, 2020

Related Articles

Provide feedback on this recommendation

Please note you are commenting on this specific recommendation. To suggest a new recommendation, please follow the link on the homepage. By proceeding with your comment here, you understand that your comment will be publicly visible and you may be contacted by JATS4R in case of further clarification.

You may use markdown to format your comment. For example, to allow <> tags to display, please start and end that portion of your comment with three backtick characters, ```.