Skip to content

Instantly share code, notes, and snippets.

@EngPeterShaker
Forked from MadhuNimmo/rangeerror.js
Created August 20, 2024 13:49
Show Gist options
  • Save EngPeterShaker/21c223311cf732b170c801895d5c0f5b to your computer and use it in GitHub Desktop.
Save EngPeterShaker/21c223311cf732b170c801895d5c0f5b 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