question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

how to post a huge javascript object

See original GitHub issue

Describe the issue When posting a large object through axios post method, the browser will crash

Example Code

// Example code here
// this object will be very large;
const data = {........};
// JSON.stringify(data).length will be 550000000 which means nearly 550MB!
axios.post('http://xxx.yy.com/api/', importData, {
      headers: { 'content-type': 'application/json' },
    }).then(msg => window.console.log('success:', msg))
    .catch(err => window.console.log('error: ', err));

Expected behavior, if applicable A clear and concise description of what you expected to happen.

Environment:

  • Axios Version 0.17.0
  • OS: Win10
  • Browser Chrome
  • Browser Version 76
  • Additional Library Versions React.16.8

Additional context/Screenshots chrome page will crash and showing this picture… image

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
dimonchoocommented, Sep 5, 2019

Are you sure, that is correct way to done task? Maybe would be correct way to do task in the background? Server -> server? sorry for eng

0reactions
chinesedfancommented, Dec 4, 2019

Maybe you can try web workers.

Anyway, it is not an issue of axios. We suggest users ask similar questions in stackoverflow. Good luck!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How upload large JSON object in javascript with form data?
I'm trying to upload a very large object that contains several arrays within which are more arrays. I tried to upload using FormData...
Read more >
When You Should Prefer Map Over Object In JavaScript
In this post, I will break down all the reasons when you should consider using Map more and its performance characteristics with benchmarks....
Read more >
What is an Object in JavaScript? - CodeBrainer
In this blog post, we explain: What is an Object in JavaScript; How to add methods to JavaScript objects; What is a constructor;...
Read more >
How to send a JSON object to a server using Javascript?
In this example we are going to use AJAX (Asynchronous JavaScript And XML), to send data in background. We are using PHP for...
Read more >
I have a large JSON object (~2GB), what's the best way to ...
I have a large JSON object file that was converted from a table. I programmed a website using HTML and JS that lets...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found