[whatwg/fetch] How to parse BigInt using Response.json() function ? (Issue #1473)

There is a [TC39 proposal](https://github.com/tc39/proposal-json-parse-with-source) at stage 3 to enhance [`JSON.parse`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse) to allow `reviver` functions access to input source text. Among other things, this enhancement will enable very large numbers in JSON to be parsed as BigInt values (see [example](https://github.com/tc39/proposal-json-parse-with-source#illustrative-examples))

[`Response.json()`](https://developer.mozilla.org/en-US/docs/Web/API/Response/json) on the other hand does not have the `reviver` option - thereby offering no way to support BigInts. Of course, the workaround is to use [`Response.text()`](https://developer.mozilla.org/en-US/docs/Web/API/Response/text) and call JSON.parse with the desired reviver function, but that would also mean Response.json will be left behind in comparison to JSON.parse

Is it within the scope of Fetch standard to maintain functional parity between JSON.parse and Response.json?
Thank you.

_Related tc39 issue: https://github.com/tc39/proposal-json-parse-with-source/issues/34_

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/issues/1473
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/fetch/issues/1473@github.com>

Received on Friday, 29 July 2022 01:38:11 UTC