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
- 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?