Return to Snippet

Revision: 51938
at October 7, 2011 23:12 by oozolii


Initial Code
if(typeof window.JSON=='undefined') {
	window.JSON = {
		parseJSobject : function (object) {
			var temp = '{';
			var s = 0;
	    	for(i in object) {
	    		if(s) { temp+=','; }
	    		temp += '"'+i+'":';
				if(typeof object[i] == 'object') {
					temp += this.parseJSobject(object[i]);
				} else {
					temp += '"'+object[i]+'"';
				}
				s++;
			}
	    	temp += '}';
	    	return temp; 
		},
	    stringify : function(data){
	    	return this.parseJSobject(data);
	    }
	};
}

Initial URL

                                

Initial Description

                                

Initial Title
Json to string. if native JSON.stringify not exists.

Initial Tags
javascript, json

Initial Language
JavaScript