How can I handle an 850 MB JSON response in JavaScript?

0
0
Asked By MellowQuartz42 On

I'm making an API request with Axios, and the response contains nearly 850 MB of JSON. The request appears to succeed, but response.data is an empty string. The same approach worked with about 300 MB, so I'm guessing I'm hitting a size or memory limit. I understand that streaming would be preferable, but for now I need to receive and parse the entire JSON document. Is there a way to make this work reliably?

1 Answer

Answered By BrightOtter_29 On

The practical fix is to change the API contract: paginate the records, return a downloadable file, or provide a streamable format such as NDJSON. A single 850 MB JSON response is fragile and difficult to restart if the connection fails. If you control the server, split the data into smaller chunks and process each chunk independently.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.