We often come across this issue where the object or value passed to JSON.stringify is more than it can handle and the most common solution offered on google is using alternate libraries to stream the data whereas the simplest solution to it is just to stringify one element at a time and concatenate them.
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)+"]";
You can also save the gist here for future references.
Hope this solution helps you at some point.