Tech News
← Back to articles

Why I stopped using JSON for my APIs

read original related products more articles

Or why I stopped using JSON for my APIs

If you develop or use an API, there’s a 99% chance it exchanges data encoded in JSON. It has become the de facto standard for the modern web. And yet, for almost ten years, whenever I develop servers—whether for personal or professional projects—I do not use JSON.

And I find it surprising that JSON is so omnipresent when there are far more efficient alternatives, sometimes better suited to a truly modern development experience. Among them: Protocol Buffers, or Protobuf.

In this article, I’d like to explain why.

Serialization

Before going any further, let’s put the topic back into context.

An API (Application Programming Interface) is a set of rules that allow two systems to communicate. In the web world, REST APIs—those using the HTTP protocol and its methods (GET, POST, PUT, DELETE…)—are by far the most widespread.

When a client sends a request to a server, it transmits a message containing:

headers , including the well-known Content-Type , which indicates the message format (JSON, XML, Protobuf, etc.);

, including the well-known , which indicates the message format (JSON, XML, Protobuf, etc.); a body (payload), which contains the data itself;

... continue reading