tc39 / proposal-json-parse-with-source

Proposal for extending JSON.parse to expose input source text.
https://tc39.github.io/proposal-json-parse-with-source
MIT License
214 stars 9 forks source link

How to parse bigints when using Response.json() function? #34

Open pspraveenkr opened 2 years ago

pspraveenkr commented 2 years ago

In many cases, JSON parsing happens indirectly when an application calls Response.json() function after fetching JSON payload from a service using the Fetch API.

Would it be within the scope of this proposal to enhance Response.json() to add support for reviver option? Or, is the recommendation to use Response.text() and then call JSON.parse directly with a reviver function?

Thank you for advancing this proposal! We at Esri are tracking this proposal as part of adding support for big integers to our ArcGIS Online Cloud platform. Not being able to serialize and de-serialize is a blocker at the moment.

ljharb commented 2 years ago

Response isn’t a thing in the language - it’d be the job of, in this case, HTML to add support for it.

pspraveenkr commented 2 years ago

I will open an issue at https://github.com/whatwg/fetch which looks like the right spot for this question.

Thanks!