JSON.stringify gotchas Playground

Bayu prints a customer’s record in the passbook as JSON and reads it back: undefined, Date, NaN, Map, BigInt, a record pointing at itself, which print whole…

Why it matters

Every time you send data to an API, save it to localStorage, or "deep copy" with JSON.parse(JSON.stringify(x)), these traps wait: fields vanish silently, dates change type, or the app stops on a loop or a BigInt.

The key idea

JSON knows six kinds; the rest is dropped, changed, or throws

Common mistakes

Try it in this playground