Very easy to use JsonToString method
Jsontostring code
function JsonToString(o) {
var arr = [];
var fmt = function(s) {
if (typeof s == 'object' && s != null) return JsonToStr(s );
return /^(string|number)$/.test(typeof s) ? "'" s "'" : s; .push("'" i "':" fmt(o[i]));
return '{' arr.join(',') '}';
}
I feel great using it anyway, haha
Also: If you don’t want the numbers in json to be stringified. You can modify it:
return /^(string|number)$/.test(typeof s) ? '"' s '"' : s; is: return /^(string)$/.test(typeof s) ? '"' s '"' : s; (actually just ignore the number type)