jweinst1
5/21/2016 - 6:59 PM

jsonstringer.js

//sample json stringer

function maxstringJSON(len){
	var tokens = ["{"];
	for(var i=0;i<len;i++){
		tokens.push('"foo":{');
		
	}
	for(var j=0;j<len;j++){
		tokens.push("}");
	}
	//closes the last parenthiss
	tokens.push("}");
	return tokens.join("");
}
/*   JSON.parse(maxstringJSON(500))
=> { foo: { foo: { foo: [Object] } } }
   JSON.parse(maxstringJSON(1000))
RangeError: Maximum call stack size exceeded*/