ソースを参照

Added double quotes around keys in JSON encoded strings to conform with JSON format.

Robert Larsen 14 年 前
コミット
502d313351
1 ファイル変更1 行追加1 行削除
  1. 1 1
      core/convenience.js

+ 1 - 1
core/convenience.js

@@ -122,7 +122,7 @@
         if (!i.match(/^[a-z0-9]+$/i)) {
         if (!i.match(/^[a-z0-9]+$/i)) {
           throw new sjcl.exception.invalid("json encode: invalid property name");
           throw new sjcl.exception.invalid("json encode: invalid property name");
         }
         }
-        out += comma + i + ':';
+        out += comma + '"' + i + '"' + ':';
         comma = ',';
         comma = ',';
         
         
         switch (typeof obj[i]) {
         switch (typeof obj[i]) {