Serialization converts structured in-memory data into language-agnostic bytes for transfer, while deserialization reconstructs client-side data. Because languages differ, every protocol loses some information. section 5.0 section 5.1
Follow the data path from an API server’s structured resources to serialized bytes and back into a client representation. section 5.1
Design serialization around the format exposed by the API, not merely the types of its implementation language:
- Choose representations that work across client languages, commonly using JSON and its available data types. section 5.1
- Treat null, omitted fields, and empty values as distinct cases when defaults and input behavior matter. section 5.0
- Avoid assuming numeric values survive unchanged across languages, especially beyond 32-bit or 64-bit limits and with decimal precision. section 5.3.3
Preserving decimal values
Serialize decimal values such as 0.1 and 0.2 as strings, then parse them with Decimal.js before arithmetic. This avoids JSON number parsing and floating-point precision problems. section 5.3.3
Resource transfer and bulk export need not share one format. JSON may suit individual resources, while newline-delimited JSON, CSV, or TSV can suit exports; compression, encryption, and file splitting can follow serialization. Keep data retrieval separate from format processing so sources and destinations remain reusable. section 23.3.3























