Parse, Don't Guess: Why Your JSON Deserializer Shouldn't Be Making Decisions For You

Published on 02.03.2026

bash — 80×24$pnpm dev▶ ready on localhost:3000$git commit -m "feat: og images"$npx tsc --noEmit✓ 0 errorsCODING

Parse, Don't Guess

TLDR: Automatically converting all numeric strings to BigInts during JSON deserialization caused CPU freezes in production because regex checks ran against every string in every document on every request. The fix was not a better regex but removing the guessing entirely and replacing it with explicit upcast/downcast functions that only transform the fields you declare, which also unlocked proper schema versioning for free.

Parse, Don't Guess

External Links (1)