Why can the same JSON.parse be used under IE but not under CHROME?

  node.js, question

This is the only way under Google.
[{“goodsNo”:”1″,”buyNum”:”1″},{“goodsNo”:”1″,”buyNum”:”1″}]
I want to continue to add objects. I hope it looks like this
[{“goodsNo”:”1″,”buyNum”:”1″},{“goodsNo”:”1″,”buyNum”:”1″},{“goodsNo”:”1″,”buyNum”:”1″}]
[{“goodsNo”:”1″,”buyNum”:”1″},{“goodsNo”:”1″,”buyNum”:”1″},{“goodsNo”:”1″,”buyNum”:”1″},…,…]

There are no problems under IE.

Sorry, the problem was not clearly described.

var $goodsNo = $('#goods-no').val();
 var $buyNum = $('#buy-num').val();
 var goods = new Object();
 goods.goodsNo = $goodsNo;
 goods.buyNum = $buyNum;
 var cookieValue = getCookie("goods");
 
 if (cookieValue == "") {
 console.log("empty");
 var arr = [];
 arr.push(goods);
 var jsonStr = JSON.stringify(arr);
 } else {
 var oldGoodsValue = base64Decode(cookieValue);
 console.log(oldGoodsValue);
 var jsonObject = JSON.parse(oldGoodsValue);
 jsonObject.push(goods);
 var jsonStr = JSON.stringify(jsonObject);
 bracket
 setCookie("goods", base64Encode(jsonStr), 3000);

There was an error when I converted the json string (oldGoodsValue) into an array of JSON objects, that is
var jsonObject = JSON.parse(oldGoodsValue);
There is a mistake in this sentence.

The error message is this uncaught syntax error: unexpected token.

OldGoodsValue value is

[{“goodsNo”:”1″,”buyNum”:”1″},{“goodsNo”:”1″,”buyNum”:”1″}]

It is possible that the characters cannot be processed because they are not escaped. . I just escaped them on the console.
However, there is a question, why does it not escape automatically? Although it can be escaped manually, what should I do if I encounter quotation marks?
图片描述


The problem has been solved. It is the base64 decoding function that has a problem. .

I don’t know what you want, can you describe the problem more clearly?