Repository navigation
querystring.stringify does not support BigInt #36080
Description
Activity
- addedfeature requestIssues requesting new Node.js features.Issues requesting new Node.js features.querystringIssues and PRs related to the built-in querystring module.Issues and PRs related to the built-in querystring module.
on Nov 12, 2020 - added a commit that references this issue
on Nov 13, 2020 @kennytm what will be the use case of sending such large numbers in bigint form, ideally one will prefer to use string for such cases instead of bigint. Also when the parsing is applied what should be the value of the key, should it be
12345678901234567or12345678901234567nas both are valid options. Can you elaborate on the feature request?@yashLadha There is a server producing JSON containing numbers recently upgraded to include 64-bit IDs. (The server is not written in JS and they have a well-defined schema so there is no problem handling 64-bit integers in JSON or query). So we used
json-bigintto parse the output. Later we used theurlmodule to generate a GET request, which internally used thequerystringmodule to serialize the query. So that 64-bit ID becomes blank as abigintisn't anumber/string/boolean.Yes we know we can
.toString()and that's indeed our current workaround, but that can be said the same fornumberandboolean.querystring.parsewon't produce numbers so I don't see why parsing is relevant. The serialization should never contain the "n", as non-JS environment needs to process the output ofquerystring.- added a commit that references this issue
on Dec 21, 2020 - added a commit that references this issue
on May 1, 2021 - added a commit that references this issue
on May 22, 2026
Is your feature request related to a problem? Please describe.
it should print
a=12345678901234567Describe the solution you'd like
support
bigintin additional tostring,numberandboolean.i.e., in
stringifyPrimitiveencode any value wheretypeof v == 'bigint'as'' + v, the same as'number'.Describe alternatives you've considered
No.