JSON, Protobuf, Parquet, XML, etc.

By The Coding Gopher

Published: 2026-08-11

URL: https://thecodinggopher.substack.com/p/the-architecture-of-data-serialization


In software engineering, your in-memory objects—like a User class complete with arrays, nested data, and local state—cannot be sent as raw memory over a network to a server written in an entirely different language. You must translate that state into a standardized, sequential stream of bytes.Serialization - Wikipedia

This process is called serialization.

The format you choose to serialize your data dictates how fast your services communicate, how much bandwidth they consume, and how easily they can be debugged. Here is an overview of the four dominant serialization formats and when to use them.Serialization vs Deserialization with Example | Yash Patel Blog

Data serialization is the process of converting complex in-memory data structures or objects into a standardized, portable format (like bytes, a string, or a stream) so they can be easily stored on disk or transmitted across a network. The reverse process is called deserialization.

What is serialization and how does it work? | Hazelcast

Why It Matters

In-memory objects contain pointers and memory addresses unique to a specific program’s runtime. Serialization strips away these machine-specific references. By packaging the data into a flat or nested text stream, it allows different systems, microservices, or programming languages to safely read, modify, and reconstruct the exact same data.

Subscribe now

1. JSON (JavaScript Object Notation)

JSON is a text-based format that relies on simple, human-readable key-value pairs (e.g., {"firstName": "John", "zip": "90210"}).Manipulating JSON Documents in .NET 8

Its primary advantage is flexibility and developer ergonomics. Because it lacks strict schemas, you can add a new field to your API, and older clients will generally ignore it without crashing. It is also native to web browsers, making it the standard choice for frontend-to-backend communication.Understanding JSON Schema Lexical and Dynamic ScopesYou can add a schema to a JSON file to enforce structure, add data types, and get autocomplete features in code editors like VS Code.

However, JSON is verbose. Every time you send a record, you must transmit the field names as strings along with the actual data. It is comparatively slow for a machine to parse and lacks strict typing. Despite this, for public-facing REST APIs, developer convenience and browser compatibility generally outweigh raw network speed.What is JSON?. JSON stands for JavaScript Object… | by Ekaterine Mitagvaria  | Medium

2. Protocol Buffers (Protobuf)

Developed by Google, Protobuf is a strongly typed, binary serialization format designed for speed and efficiency.Deep Dive gRPC: Protobuf & HTTP/2.0 | by Chang Liu | MediumThe Protocol Buffers (Protobuf) flow is a process for serializing structured data into a compact, language-neutral binary format. Developed by Google, this workflow allows applications written in different languages (like Java, Python, and C++) to communicate seamlessly using a shared "contract".

Instead of sending keys over the wire every time, Protobuf uses a pre-compiled schema (a .proto file) shared by both the sender and the receiver ahead of time. This allows Protobuf to transmit only the compressed bytes of the value itself.Practical Protobuf - From Basic to Best Practicesprotoc-gen-go is a plugin for the Google Protocol Buffer compiler (protoc) that generates Go-specific code from .proto definition files.

This makes Protobuf fast to serialize and deserialize, significantly reducing network payload size. It also enforces strict data contracts, preventing bugs where a sender changes a data type unexpectedly. The trade-off is that it is unreadable to humans without the schema. Protobuf is the industry standard for internal microservice communication (such as gRPC), where services communicate at high volumes and performance is critical.Everything you need to know about gRPC and ProtoBuf - SecturegRPC (gRPC Remote Procedure Calls) is an open-source, high-performance communication framework developed by Google. It allows a client application to call methods on a server located on a different machine as if it were a local object, simplifying the creation of distributed services.

𝐋𝐞𝐚𝐫𝐧 𝐭𝐨 𝐛𝐮𝐢𝐥𝐝 𝐆𝐢𝐭, 𝐃𝐨𝐜𝐤𝐞𝐫, 𝐑𝐞𝐝𝐢𝐬, 𝐇𝐓𝐓𝐏 𝐬𝐞𝐫𝐯𝐞𝐫𝐬, 𝐚𝐧𝐝 𝐜𝐨𝐦𝐩𝐢𝐥𝐞𝐫𝐬, 𝐟𝐫𝐨𝐦 𝐬𝐜𝐫𝐚𝐭𝐜𝐡. Get 40% OFF CodeCrafters: https://app.codecrafters.io/join?via=the-coding-gopher

This Substack is reader-supported. To receive new posts and support my work, consider becoming a free or paid subscriber.

3. XML (eXtensible Markup Language)

XML uses a nested, tag-based structure. It is highly expressive, supporting complex metadata through attributes and namespaces, and features strict schema validation (XSD) to ensure data compliance before a payload is processed.

In XML, attributes provide extra information about elements, while namespaces provide a way to uniquely name elements and attributes to prevent naming conflicts.

Edit XML Files | Online Editing & Programmatic Approach

However, XML is notoriously verbose. Because every opening tag requires a matching closing tag, the structural overhead often outweighs the actual data being sent.

While rarely chosen for new projects today, understanding XML is mandatory if your software needs to integrate with legacy enterprise systems, banking networks, or large-scale government infrastructure.

4. Apache Parquet

While JSON, Protobuf, and XML serialize data row-by-row, Apache Parquet serializes data column-by-column.Apache Parquet, What It Is and Why to Use It | QuestDBApache Parquet is column-based to optimize performance and storage efficiency for large-scale analytical workloads. Unlike row-based formats (like CSV) that store entire records together, Parquet groups all values for a single column contiguously on disk.

The above diagram illustrates schema evolution—specifically, how schema merging works when a column is added or changed across different Parquet files.

-

Original Data (Blue Table): This represents an older Parquet file with three columns: A, B, and C. It contains the first three rows of data.

-

New Data (Green Table): This represents a newer Parquet file where the schema has changed. Column C is no longer present, and a new column D has been added. It contains rows 4 and 5.

-

Merged Result (Yellow Table): This shows the unified result when a system reads both files together.

-

The reading engine creates a superset of all columns found in the files: A, B, C, and D.

-

For the older data (rows 1-3), since column D did not exist when that file was written, the system fills column D with null values.

-

For the newer data (rows 4-5), since column C was not included in that file, the system fills column C with null values.

This demonstrates how Parquet gracefully handles reading data across files with different schemas by padding missing columns with null values.File Format | Parquet

Grouping identical data types together makes Parquet highly compressible. It allows analytics engines to scan only the specific columns they need without loading the entire database into memory.

The downside is that Parquet performs poorly for single-record writes. It is designed strictly for batch processing, making it the standard for modern data engineering and data lakes where millions of records are stored for heavy analytical querying and reporting.

Use Parquet over formats like CSV or JSON for read-heavy, large-scale data analytics. It is a columnar format, meaning it stores data by column rather than row. This drastically reduces disk I/O, optimizes compression, and speeds up query times for big data.

Choosing the Right Format

When mapping out a new system, your decision generally depends on the environment:

-

JSON: Use when the data needs to be human-readable or consumed by a web browser.

-

Protobuf: Use for high-performance communication between backend servers.

-

Parquet: Use for storing large volumes of data for analytics and batch processing.

-

XML: Use when integration with legacy enterprise systems or mainframes is required.

This Substack is reader-supported. To receive new posts and support my work, consider becoming a free or paid subscriber.

Thanks for reading! This post is public so feel free to share it.

Share