serialization
Turning an in-memory object into bytes, such as JSON text, that can be sent or stored, and parsing it back again.
In more detail
Serialization mistakes, such as a missing field or a number written as a string, only show up when data really crosses a boundary, which is why integration tests matter. The reverse step, deserialization or parsing, must reject malformed input safely.
Examples
kafka-python: KafkaProducer(value_serializer=lambda v: json.dumps(v).encode())KafkaProducer(value_serializer=lambda v: json.dumps(v).encode())kafka-python: KafkaConsumer(value_deserializer=lambda v: json.loads(v.decode()))In the browser: localStorage only stores strings, so objects are serialized with JSON.stringify and deserialized with JSON.parse. A resilient deserializer catches parse errors and returns a default instead of crashing.JSON.stringify turns a query key array into a cache key string.Go: json.Marshal to encode, json.Unmarshal to decodeProps from a Next.js Server Component to a Client Component are serialized into the RSC payload; Promises and Server Actions can cross, ordinary functions cannot.JSON.stringify() and JSON.parse() are synchronous and block the Node.js main thread while they run.In this course: A serializer that disagrees with the other side of a connection only shows up when real bytes cross the wire, which is why integration and contract tests exist. Common formats are JSON, Protocol Buffers and Python's own pickle.Related terms
- JSON — A simple text format for structured data made of keys, values, lists and nested objects.
- integration test — A test that checks several real parts working together, such as the service talking to a real database.
- Apache Avro — A compact binary serialization format whose schemas are written as JSON documents.
- Protocol Buffers — A language-neutral way to define data structures and services in .proto files and encode messages in a compact binary format.
- record value — The main content of a record, stored by Kafka as raw bytes it never inspects.
- JsonSerializer — The .NET class, part of System.Text.Json, that converts objects to JSON text and back.
- input formatter — The component that reads a request body in a given format, such as JSON, and deserialises it into the action's parameter type.
- JSON.stringify() — The JavaScript function that converts a value into a JSON string; JSON.parse() converts the string back.
- structured clone algorithm — The standard JavaScript algorithm for deep-copying values between threads and into storage, which handles Maps, Sets, Dates, typed arrays and circular references.
- localStorage — A browser feature that saves small text values for a website so they are still there after the page is closed and reopened.
- query key — The array that names a piece of cached server data in TanStack Query, such as ["users", "detail", "10"].
- Server-Sent Events — A standard way for a server to keep an HTTP response open and push a stream of text events to the client, in one direction only.
- encoding/json — Go's standard library package for converting between Go values and JSON text.
- json.Marshal — The Go function that encodes a value, such as a struct or slice, into JSON bytes.
- json.Unmarshal — The Go function that decodes JSON bytes into a Go value you pass by pointer, such as &reply.
- Jackson — The most widely used Java library for converting between Java objects and JSON, and the default in Spring Boot.
- wire format — The exact shape data takes when it travels between programs, such as the field names and types of a JSON body.
- props — The inputs passed to a component, written like HTML attributes, such as <Avatar size={48} />.
- RSC payload — The compact data stream React produces from Server Components, describing the rendered tree, props for Client Components and placeholders.
- server-only — A small npm package that makes the build fail if a module containing it is imported into client code.
- CSV — Comma-separated values: a plain-text table format with one row per line and fields separated by commas.
- broken object property level authorization — OWASP's name for letting a caller read or write individual fields of an object they may access but should not see or change.
- schema validation — Checking incoming data against a declared shape, such as allowed field names and types, and rejecting anything that does not fit.
- latency budget — A latency target divided among the hops a request makes, so each part knows how much time it may spend.
- hop — One step a request takes between two machines or programs on its way to the final server.
- contract testing — Testing that an API’s real behaviour matches its written contract, and that its callers only rely on what the contract promises.
Taught in
- Unit And Integration Testing — Modern API Architecture: REST, GraphQL & gRPC
- Twenty Seconds Of Nothing — Confluent Apache Kafka Certifications (CCDAK and CCAAK) Exam Prep
- The Field The Registry Refused — Confluent Apache Kafka Certifications (CCDAK and CCAAK) Exam Prep
- Green Tests, Red Production — Confluent Apache Kafka Certifications (CCDAK and CCAAK) Exam Prep
- The Alert That Came An Hour Late — Confluent Apache Kafka Certifications (CCDAK and CCAAK) Exam Prep
- Stuck On One Record — Confluent Apache Kafka Certifications (CCDAK and CCAAK) Exam Prep
- A Sink That Died On Record Nine — Confluent Apache Kafka Certifications (CCDAK and CCAAK) Exam Prep
- Two Controllers At Once — Confluent Apache Kafka Certifications (CCDAK and CCAAK) Exam Prep
- Classes, Interfaces, and Object-Oriented C# — Modern .NET Core, C# & Enterprise Microservices
- Building Routes with Controllers — Modern .NET Core, C# & Enterprise Microservices
- The Repository Pattern — Modern .NET Core, C# & Enterprise Microservices
- Integration Testing with WebApplicationFactory — Modern .NET Core, C# & Enterprise Microservices
- Web Workers: Off-Thread Computation And Structured Clone — Frontend Architecture & Web Platform
- Client Storage Paradigms: Cookies, Storage Tradeoffs — Frontend Architecture & Web Platform
- Type-Safe Client Generation: Orval & Automated SDKs — Production Full-Stack Engineering
- Session Architecture: HTTP-Only Cookies vs Tokens — Production Full-Stack Engineering
- Server-Sent Events: Streaming Updates & Recovery — Production Full-Stack Engineering
- Full-Stack System Verification: Capstone Integration — Production Full-Stack Engineering
- Type Assertions and the Empty Interface — Concurrent Systems Programming with Go
- Pattern Matching And Text Blocks — Modern Java: Virtual Threads & High-Throughput Services
- Serialization And JSON — Modern Java: Virtual Threads & High-Throughput Services
- Working With Jackson — Modern Java: Virtual Threads & High-Throughput Services
- Console And File I/O With Streams — Oracle Certified Professional: Java SE 21 Developer (1Z0-830) Exam Prep
- Serialization: What Survives The Trip — Oracle Certified Professional: Java SE 21 Developer (1Z0-830) Exam Prep
- Sprint: I/O And Localization — Oracle Certified Professional: Java SE 21 Developer (1Z0-830) Exam Prep
- Keys And Ordering Per Partition — Apache Kafka & Event Streaming
- Duplicates Are The Default — Apache Kafka & Event Streaming
- Poison Messages And Dead Letter Topics — Apache Kafka & Event Streaming
- Bytes On The Wire: JSON, Avro And Protobuf — Apache Kafka & Event Streaming
- Evolving An Event Without Breaking Consumers — Apache Kafka & Event Streaming
- Headers, Envelopes And Event Metadata — Apache Kafka & Event Streaming
- Component Tree Composition: Interleaving RSC & Client — Next.js 15 & Modern App Router Architecture
- Serialization Boundaries: Props & Server Guardrails — Next.js 15 & Modern App Router Architecture
- Poll & Check Phases: I/O Callbacks & setImmediate — Node.js Internals & Backend Services
- Child Processes: spawn, execFile, fork & IPC — Node.js Internals & Backend Services
- Worker Threads: worker_threads & SharedArrayBuffer — Node.js Internals & Backend Services
- JSON And CSV — Hands-on Python: Complete Video Course & Book
- Mass Assignment — Application Security & Threat Modeling for Engineers
- Latency Numbers Every Engineer Should Know — Scalable System Design & Distributed Architecture
- Timeouts, And Avoiding Cascaded Failure — Scalable System Design & Distributed Architecture
- Integration Testing With Containers — Automated Testing, TDD & Quality Engineering
References
- Python docs: json
- MDN: serialization
- kafka-python KafkaProducer
- Serialization in .NET
- Package encoding/json
- RFC 8259: The JSON data interchange format
- jackson-databind
- OWASP Deserialization Cheat Sheet
- React docs: 'use client'
- pickle documentation
- OWASP API3:2023 Broken Object Property Level Authorization