1 /** 2 * @fileOverview adapt json2 to kissy 3 */ 4 KISSY.add('json', function (S, JSON) { 5 6 return S.JSON = { 7 8 parse:function (text) { 9 // 当输入为 undefined / null / '' 时,返回 null 10 if (text == null || text === '') { 11 return null; 12 } 13 return JSON.parse(text); 14 }, 15 16 stringify:JSON.stringify 17 }; 18 }, { 19 requires:["json/json2"] 20 }); 21