JSON is Clearly the King of API Data Formats in 2020

A reader recently wrote into ProgrammableWeb asking if we had any recent data on API support of JSON versus XML. We didn’t have the data offhand but a quick query into our API directory could surely provide insight into this question. Additionally, the data may be able to give us some clues into how frequently APIs of different styles are being developed.

To start with, we took a look at the most common request and response formats across all APIs since the start of ProgrammableWeb in 2005. The table below summarizes the data.

Supported Request
Data Formats
Count APIs
(All-time)
Supported Response
Data Formats
Count APIs
(All-time)
URI Query String/CRUD
18985
JSON
16442
JSON
7514
XML
14740
XML
4333
CSV
5388
SOAP
2329
GeoJSON
4817
Unspecified
1290
SOAP
2329
JSONP
814
Unspecified
1840
Webhooks
198
JSONP
814
JSON API
180
Text
300
Websockets
96
RSS
253
CSV
87
URI Query String/CRUD
228
RDF
77
JSON API
180
GraphQL
68
Atom
109
Binary
47
Websockets
96
SMTP
35
HTML
91
Text
35
YAML
89

The clearest finding is the dominance of REST styled APIs. URI Query String/CRUD as a request format refers to an APIs ability to leverage the HTTP protocol in order to take action on an API resource. This is most commonly seen on REST-styled APIs and thus the use of URI Query String/CRUD in the request signals the use of RESTful architecture. With 18,985 web APIs using this request format, it is safe to say that REST is used by nearly 83% of the APIs in the directory. This is not a surprise by any means, but it is a stark reminder of just how prevalent REST has become over the last decade-plus.

While we are discussing URI Query String/CRUD, you may notice that it appears more than 200 times as a response data format. The great majority of these are due to event-driven APIs that use Webhooks. In a Webhooks API the client request indicates what Webhooks-based stream it wants to subscribe to. The stream is implemented through an approach where the client provisions an HTTP-based API that the server calls. When the server has an update it makes a RESTful call to the client. That’s why the response from the server would include URI Query String as a data format. For more information, please read our article on how Webhooks APIs work.

The second result worth noting is that JSON, as expected, is the most popular response data format in use. The advantages of JSON over XML including lighter payloads, greater readability, reduced machine overhead for serialization/deserialization, easier consumption by JavaScript among others, have been discussed for years. So it’s no surprise that JSON is the format of choice. It’s also interesting to see that XML is used about 90% as often as JSON.

While the all-time data are helpful for understanding APIs in the big picture, it may be useful to consider where APIs are trending in recent years. We queried our database from March 2018 through March 2020 to see what modern APIs can tell us about the direction things are heading and here’s what we found.

Supported Request
Data Formats
Count APIs
(Since March 2018)
Supported Response
Data Formats
Count APIs
(Since March 2018)
URI Query String/CRUD
3433
JSON
3551
JSON
2913
XML
663
Unspecified
291
Unspecified
303
XML
255
URI Query String/CRUD
144
Webhooks
130
CSV
118
SOAP
68
Text
97
Websockets
66
SOAP
68
JSONP
63
Websockets
66
GraphQL
53
JSONP
63
JSON API
31
GeoJSON
53
JSON-RPC
12
HTML
39
GeoJSON
11
JSON API
31
Binary
10
Atom
28
CSV
10
HAL
17

Returning to the question of JSON versus XML, we see that in the last two years JSON has been used as a response data format five-fold as many times as XML. XML is by far the number two response format used by API providers, but it is clear that JSON has been the unquestioned format of choice.

The REST architectural style and JSON data format are the staples of the API space. However, they are not the only approaches when building an API. Event-driven API architectures have been steadily growing in popularity in the last few years due to the desire for applications that perform in real-time. Two of the most popular event-driven protocols are Webhooks and WebSockets; combined they have been used in nearly 200 APIs in the last two years.

GraphQL is an RPC styled approach to APIs that has been much discussed since its arrival in 2015. While a number of overzealous commenters were quick to declare that GraphQL would replace REST, it is more properly thought of as an alternative that works extremely well in specific use cases. It has been used in 53 APIs in the last two years which is a good showing but clearly pales in comparison to the more than 3,000 new RESTful APIs to appear during the same time.

Speaking of old guard approaches, SOAP, the long-time punching bag of API development still managed to appear in 68 new APIs. One nuance here is that SOAP-based implementations invariably involve the XML data format. However, not all XML-based APIs involve SOAP. Plenty of REST-styled APIs support XML as a data format.

One final note is that Unspecified shows up as the third most frequent data format on both requests and responses. Our directory data model uses Unspecified as shorthand for when an API provider doesn’t provide this information. This may be due to poor documentation or as is often the case, the documentation is hidden behind a registration wall that prevents us from researching those details. This is one of the most common examples of poor Developer Experience (DX). To learn more about API providers who get this right, be sure to read our Editor’s Choice award for DX series of articles.

What do you think, is there anything we missed? The API space is constantly changing and our data helps us make sense of it and highlight trends. 

If you’re an API provider, adding a listing in our directory is a great way to improve the discoverability of your APIs and raise awareness of your program. If you would like to include your APIs in our directory, you can use the link below. https://www.programmableweb.com/add/api

If you are looking for a chart that we don't currently have, please write to editor@programmableweb.com. It's possible that the chart you need is in the process of getting published.

Be sure to read the next API Design article: Facebook SDK Update Causes App Failure for Spotify, TikTok, Pinterest

 

Comments (0)