json字符串转json对象:jQuery.parseJSON(jsonStr);//$.parseJSON(jsonStr)
json对象转json字符串:JSON.stringify(jsonObj);
var strCookie = "isSpecial=1; theme=thth; matchid=2001252; type=345";
strCookie = '{"'+strCookie+'"}';
var arrCookie = strCookie.replace(/=/g, '":"').replace(/; /g, '","');
arrCookie = JSON.parse(arrCookie);
console.log(arrCookie.isSpecial)
IE中可能对unicode使用“uXXXX”格式来编码,可以使用如下来解码:
function unicode2Char(str) {
return (str.replace(/\/g, "%"));
}