2026-08-26 · 6 min read · Rahul Chitturi
- json
- api
- debugging
An API value can look unchanged in a log while its JSON type has changed. The number 42 and the string "42" display similarly, but validators, sorting, arithmetic, and generated clients treat them as different contracts.
Type drift often appears after a database migration, CSV import, form rewrite, or serializer change. It can quietly turn addition into concatenation, move numeric IDs in a sort order, or make a strict mobile client reject an otherwise familiar payload.
Compare structure, not screenshots
Capture sanitized examples from the last known-good response and the failing response. Format both as JSON, then inspect the value and its surrounding field rather than relying on log rendering.
- Check whether integers, decimals, booleans, and nulls became quoted strings
- Inspect arrays for mixed types introduced by partial backfills
- Compare OpenAPI or JSON Schema definitions with the wire payload
- Trace the first serializer that changes the value's type
Choose the contract intentionally
Identifiers may intentionally be strings when leading zeros or values larger than JavaScript's safe integer range matter. Quantities used in arithmetic usually belong as numbers. The important part is consistency across producers, consumers, fixtures, and documentation.
Avoid adding broad client-side coercion as the first fix. It can hide upstream drift and make invalid values such as empty strings or formatted currency appear acceptable.
A Flashman workflow
Use the JSON formatter to expose types, the diff tool to compare fixtures, the case converter to spot renamed boundary fields, and the units converter when a value also changed scale.
Record the expected type, valid range, null behavior, and one regression fixture. That gives every client a precise contract instead of another guess.