I have a JSON object that I am trying to manipulate by changing the value of its property "quantity"
"[{"name":"Butter","image":"/static/images/items/dairy/butter.jpg",
"price":" 30 uah","quantity":"1","alias":"butter"},
{"name":"Chesse","image":"/static/images/items/dairy/cheese.jpg",
"price":" 60 uah","quantity":"1","alias":"chesse"}]"
After accessing the property value json[0].quantity
, I attempt to update it with the following code:
var quantity = parseInt(json[0].quantity);
json[0].quantity = String(quantity + 1);
Unfortunately, the attempted change does not take effect. The "quantity"
property remains unchanged. Any assistance would be greatly appreciated.