News APIs: Why JSON Usually Wins Over XML

News APIs: Why JSON Usually Wins Over XML

News APIs connect applications to online news content and power many kinds of platforms — media intelligence, sales intelligence, financial analysis, regulatory compliance tracking, and the list goes on. Most providers offer news API responses in both JSON and XML, but developers overwhelmingly choose JSON over XML. This article delves into why so many developers prefer JSON as the format for news data delivery.

XML explained

XML stands for Extensible Markup Language. The W3C created it in the late 1990s as a means of representing structured documents on the web. Most web documents are structured, e.g., paragraphs, images, lists, and links. It was commonly used in early web services and applications. Later, developers began using XML to represent structured data, and they created standards like DOM (Document Object Model) where XML objects are represented as ordered tree structures. Many developers find XML challenging to use with most programming languages because of its tree structure. 

Screenshot of a response from the News API in XML format
Screenshot of a response from the News API in XML format

JSON explained

JSON stands for JavaScript Object Notation, and it is an open data interchange format created by Douglas Crockford in the early 2000s. He broke out the data structure part (object model) of the JavaScript programming language to create JSON. JSON was designed to handle different data types, natively supporting string, number, null, object, array, and Boolean (true or false). JSON uses key-value pairs to represent structured data, which is much simpler for programming languages to work with than ordered trees.

Screenshot of a response from the News API in JSON format
Screenshot of a response from the News API in JSON format

Why JSON is the preferred response format for News APIs

Applications and platforms that leverage a news API often require real-time news data or numerous global news data sources. Users of news-powered applications also tend to expect high speed and performance. JSON enables developers to meet these requirements. Other reasons developers often choose JSON over XML include:

  • Lightweight — XML involves a tag structure resulting in larger file sizes, while JSON represents objects without using tags, making it more compact. JSON is generally more lightweight than XML in terms of file size and parsing overhead, allowing platforms and applications to transmit data faster and process data more efficiently. 
  • Native JavaScript Support — JSON is a subset of JavaScript, which means you can directly parse it using JavaScript’s built-in JSON.parse() and JSON.stringify() functions. This native support in JavaScript has made JSON a natural choice for web development, where JavaScript is commonly used.
  • Widespread Adoption — Developers can find many tools and libraries for working with JSON data, which has helped this data interchange format become widely adopted by the developer community. Developers often choose JSON for its beneficial qualities, like ease of use and compactness, which has resulted in its ubiquity in web-based applications.
  • Popularity in NoSQL Databases — Many NoSQL databases, such as MongoDB and CouchDB, use JSON-like documents as their primary data format. These databases store JSON data in a natural human and machine-readable format, facilitating seamless integration between the databases and application code. You can implement schema changes more easily with JSON-format NoSQL databases than databases using the traditional row-columns format.

These are the primary reasons developers of news API-powered applications prefer JSON. However, developers choose JSON over XML for many other reasons.

JSON vs. XML: Key differences

XML is a structured document format, and JSON is a structured data format. JSON is ideal for APIs as most of them use structured data, not structured documents. The table below shows other key differences between JSON and XML.

Abbreviation meaningJavaScript Object NotationExtensible Markup Language
Designed forRepresenting structured dataRepresenting structured documents
Data representationKey-value pairsOrdered tree pattern
Supported data typesMost common: string, number, null, object, array, Boolean (true or false)Most common: string, integer, decimal, Boolean (true or false), date, time, namespace
File sizeDoesn’t use tags, more compact than XMLTag structure resulting in larger file sizes
ParsingCan parse with a standard JavaScript function, faster to parse than XMLRequires XML parser, often slow and complicated to parse
OverheadDoesn’t require namespaces, schemas, or complex data types reducing overhead when working with dataRequires namespaces, schemas, and often complex data types, increasing the overhead for data transfers
ReadabilitySimple syntax and format. Easy for humans and machines to readMachine-readable. Data enclosed in opening and closing tags, making it harder for humans to read
CompatibilitySupported natively in many programming and scripting languages. Compatible with many frameworks and librariesCompatible with many legacy systems and various programming languages
JavaScript supportDerived from JavaScript so natural fit for JavaScript applicationsDerived from SGML. Difficult to parse with JavaScript. JavaScript XML parsing libraries available
SecurityVery secure as long as you use modern programming techniques and best practicesXML structure vulnerable to unauthorized modifications if you don’t turn off DTD feature in transmission
AdoptionWidely adopted. Many developers use JSON for APIs. Ubiquitous in web-based applicationsStill commonly used, although not as widely used for APIs as JSON
NoSQL DatabasesPopular for NoSQL databases. Easier to implement schema changes compared to traditional row-columns formatSome NoSQL databases use XML. Useful for cases that require strong schema validation or involve heavily structured data

JSON rules the world of news APIs

As you can see, developers prefer JSON to deliver news data for many reasons. JSON is ideal for applications that require high volumes of real-time news data. It helps with improving the speed and performance of platforms and applications. Plus, most developers find it much easier to work with than XML. Our Commercial News API and Free News API Lite return JSON by default. Our Commercial News API also includes XML, RSS, and CSV formats. Whether JSON or XML, you can choose the best format for your application! Interested in learning more about our News APIs? Talk to one of our experts.


Subscribe to our newsletter for more news and updates!

By submitting you agree to's Privacy Policy and further marketing communications.

Ready to Explore Web Data at Scale?

Speak with a data expert to learn more about’s solutions
Create your API account and get instant access to millions of web sources