JSON does not support `BigInt` natively. Attempting to serialize a `bigint` throws a `TypeError`, requiring a replacer function or converting to string.
js
JSON.stringify({ value: 100n }, (k, v) => typeof v === "bigint" ? v.toString() : v);100 XP to Apprentice
JSON.stringify, JSON.parse, and custom replacers.
AI translates the explanation and quiz text while preserving code and answer scoring.
JSON does not support `BigInt` natively. Attempting to serialize a `bigint` throws a `TypeError`, requiring a replacer function or converting to string.
js
JSON.stringify({ value: 100n }, (k, v) => typeof v === "bigint" ? v.toString() : v);1. What happens when serializing a BigInt with standard JSON.stringify?
2. What happens to undefined values in an object during JSON.stringify?
3. Why should untrusted JSON.parse be wrapped in try/catch?