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?
3 Answers
You may be hitting Node.js/V8’s maximum string size or running out of memory while Axios buffers the response and JSON.parse creates another large in-memory representation. A document this large can require considerably more than 850 MB because the raw response, JavaScript string, parsed object, and temporary allocations may coexist. Check the actual error and enable detailed logging rather than treating an empty value as a successful response.
If the complete document is unavoidable, use a streaming HTTP response and an incremental JSON parser instead of letting Axios buffer the whole body. For a normal JSON array, the parser needs to emit individual items as they arrive; for NDJSON, process one line at a time. Also make sure the Node process has sufficient heap space, but increasing the heap alone will not bypass V8’s maximum string length or eliminate the memory overhead of parsing.
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
How To: Running Codex CLI on Windows with Azure OpenAI
Set Wordpress Featured Image Using Javascript
How To Fix PHP Random Being The Same
Why no WebP Support with Wordpress
Replace Wordpress Cron With Linux Cron
Customize Yoast Canonical URL Programmatically