We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 42467d0 commit 2433c48Copy full SHA for 2433c48
Source/Utilities/JSON.js
@@ -51,12 +51,12 @@ JSON.encode = JSON.stringify || function(obj){
51
return '"' + obj.replace(/[\x00-\x1f\\"]/g, escape) + '"';
52
case 'array':
53
return '[' + obj.map(JSON.encode).clean() + ']';
54
- case 'object':
+ case 'object': case 'hash':
55
var string = [];
56
- for (var key in obj){
57
- var json = JSON.encode(obj[key]);
+ Object.each(obj, function(value, key){
+ var json = JSON.encode(value);
58
if (json) string.push(JSON.encode(key) + ':' + json);
59
- }
+ });
60
return '{' + string + '}';
61
case 'number': case 'boolean': return '' + obj;
62
case 'null': return 'null';
0 commit comments