Skip to content

Instantly share code, notes, and snippets.

@MadhuNimmo
Created October 14, 2022 19:53
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save MadhuNimmo/61090602bf2fa4d63cc17141893a2361 to your computer and use it in GitHub Desktop.
Save MadhuNimmo/61090602bf2fa4d63cc17141893a2361 to your computer and use it in GitHub Desktop.
Simplest solution to JSON.stringify RangeError: Invalid string length
var out="[";
for(var indx=0;indx<data.length-1;indx++){
out+=JSON.stringify(data[indx],null,4)+",";
}
out+=JSON.stringify(data[data.length-1],null,4)+"]";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment