Data and Formats
Read, validate, transform, and display JSON, text, dates, and numbers.
- Serialize a small model
Turn public data properties into a JSON document.
Core ideas · 10 min - Deserialize and validate
Treat a decoded object as input that still needs checking.
Core ideas · 10 min - Naming policies
Choose consistent external property names.
Core ideas · 10 min - Inspect a JSON document
Read selected fields without defining a complete object model.
Core ideas · 10 min - Malformed JSON
Handle syntax errors at the import boundary.
Working with data · 10 min - Invariant numeric parsing
Make machine-readable decimal text independent of display language.
Working with data · 10 min - Dates without time zones
Use DateOnly when the domain means a calendar date.
Working with data · 10 min - UTF-8 is bytes
Distinguish a string’s characters from its encoded length.
Working with data · 10 min - Base64 is representation
Encode bytes for a text-only channel without claiming encryption.
Putting it together · 10 min - Line-oriented text
Choose clear rules for whitespace and empty records.
Putting it together · 10 min - Escaping CSV fields
Protect separators and quotes when exporting tabular text.
Putting it together · 10 min - A validated import pipeline
Separate decoding, validation, calculation, and display.
Putting it together · 10 min - Missing properties and explicit JSON null
Preserve the difference between absent, null, and ordinary default values.
Deeper practice · 18 min - JSON property matching is an explicit option
Decide whether differently cased wire names identify the same property.
Deeper practice · 18 min - Rejecting unknown JSON members
Use strict schema boundaries when silently ignored fields would hide mistakes.
Deeper practice · 18 min - Required JSON presence is not nonnull content
Check presence, nullability, and business meaning as separate contracts.
Deeper practice · 18 min - String enums with an explicit numeric policy
Make wire values readable while deciding whether unknown numeric values are accepted.
Deeper practice · 18 min - Numeric strings are a compatibility choice
Allow quoted numbers only when the schema intentionally permits them.
Deeper practice · 18 min - JsonElement lifetime and Clone
Return independent JSON data instead of a view owned by a disposed document.
Deeper practice · 18 min - Enumerating JSON objects without a fixed model
Inspect a bounded object while validating each property kind.
Deeper practice · 18 min - Omitting null and omitting defaults are different
Choose serialization rules without erasing meaningful zero and false values.
Applied techniques · 18 min - Property attributes override a general naming policy
Preserve a stable external name for one member while applying a broader convention.
Applied techniques · 18 min - Offsets represent instants without naming a time zone
Parse an explicit offset and preserve its relationship to UTC.
Applied techniques · 18 min - Rounding mode and rounding stage
Make numeric presentation rules explicit before aggregating rounded values.
Applied techniques · 18 min - Parsing one CSV row with quoted fields
Track quoting state instead of splitting blindly at every comma.
Applied techniques · 18 min - Escaping a URI component
Encode data as one component rather than accidentally adding query syntax.
Applied techniques · 18 min - UTF-16 units and Unicode scalar values
Avoid treating string.Length as a universal count of visible characters.
Applied techniques · 18 min - Stable property ordering for an application export
Define a deterministic output order without claiming a universal canonical JSON format.
Applied techniques · 18 min