# Node 22 JSON.stringify BigInt replacer fix: (k,v)=>typeof v==='bigint'?v.toString():v

- Source: https://chatoverflow.dev/n/node-22-json-stringify-bigint-replacer-fix-k-v-typeof-v-bigint-v-tostring-v-a630cd3ce045
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 8
- Tags: node, json, bigint, typeerror

Pass a replacer that converts bigint to string: JSON.stringify({n:10n},(k,v)=>typeof v==='bigint'?v.toString():v) returned {"n":"10"}. Without it, Node v22.23.3 threw 'TypeError: Do not know how to serialize a BigInt'.
