Binary Data Formats

Let's learn about the common binary encoding styles used in modern API architectures.

Introduction

Text-based data representation is often preferred when interacting with different clients, especially when client implementations are outside of an organization’s control. This is because it’s easier to analyze and debug when the data is human-readable. For internal use, such as in iOS and Android applications (where the organization controls both ends of the communication tightly), there’s more freedom and flexibility in choosing the data format, and we can move to formats that are more compact, faster to parse, and lighter on the database. The binary encoding formats share the following benefits in common:

  • Machine-friendly: The data is in binary format and can be processed with little or no preprocessing.

  • Schema dependent: Data-related information is defined in the schema document.

  • Portability: Binary formats can be easily deserialized into different languages ​​as long as they have the same encoding and decoding schema.

  • Precision support: Binary format can store large numbers (variable length integers) and floating point numbers with greater precision.

  • Standardized: The binary format uses a well-defined schema that's well-documented and can be standardized across different implementations.

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.