-2
は、これは私が持っている現在のJSONです:トラブル編集JSON
var _cartInfo;
var _cart = localStorage.getItem("w3lssbmincart");
_cart = decodeURIComponent(_cart);
_cart = JSON.parse(_cart);
返し_cart:
:変数は、このようなアイテムのみを保持しているように、私はそれを作るにはどうすればよい{
"value": {
"items": [{
"cmd": "_cart",
"add": "1",
"w3ls_item": "MIXZA TOHAOLL 128GB",
"amount": 52.53,
"quantity": 1,
"href": "localhost:27524/Home.aspx"
}, {
"cmd": "_cart",
"add": "1",
"w3ls_item": "Huawei 1",
"amount": 0.99,
"quantity": 2,
"href": "localhost:27524/Telemovel.aspx"
}, {
"cmd": "_cart",
"add": "1",
"w3ls_item": "Apple 1",
"amount": 1.09,
"quantity": 1,
"href": "localhost:27524/"
}],
"settings": {
"bn": "sbmincart_AddToCart_WPS_US"
}
},
"expires": "Thu, 27 Jul 2017 17:07:45 GMT"
}
を
{
"items": [{
"cmd": "_cart",
"add": "1",
"w3ls_item": "MIXZA TOHAOLL 128GB",
"amount": 52.53,
"quantity": 1,
"href": "localhost:27524/Home.aspx"
}, {
"cmd": "_cart",
"add": "1",
"w3ls_item": "Huawei 1",
"amount": 0.99,
"quantity": 2,
"href": "localhost:27524/Telemovel.aspx"
}, {
"cmd": "_cart",
"add": "1",
"w3ls_item": "Apple 1",
"amount": 1.09,
"quantity": 1,
"href": "localhost:27524/"
}]
}
お返事ありがとうございます。
'_cart = decodeURIComponent(_cart);'は何のために必要ではありませんか? – EvgenyKolyakov
'_cart = _cart.value' – Weedoze