I am trying to store some data into object from another object using loop. i tried
jQuery.each(data.forter_request.cartItems, function(index, value) {
console.log(value);
});
Here is the object i am getting
0 : {basicItemData: {…}, deliveryDetails: {…}}
basicItemData:
category: "Select Items - 20% Off"
name: "Feel The Noize Mini Skirt"
price:
amountLocalCurrency: "90"
amountUSD: "90"
currency: "USD"
__proto__: Object
productId: "362412"
quantity: 2
type: "TANGIBLE"
i want to store this data dynamically in below form
line_items: [
{
product_name: 'Feel The Noize Mini Skirt',
product_id: '362412',
product_price: 90.00,
product_quantity: 2
},
{
product_name: 'Pillows, Large (Set of 2)',
product_id: '15',
product_price: 68.00,
product_quantity: 1
},
]
console.log(initial_object) returns
{productId: "362412", name: "Feel The Noize Mini Skirt", category: "Select Items - 20% Off", quantity: 1, price: {…}, …}
category: "Select Items - 20% Off"
name: "Feel The Noize Mini Skirt"
price: {amountUSD: "45", amountLocalCurrency: "45", currency: "USD"}
productId: "362412"
quantity: 1
type: "TANGIBLE"
s their any way we can do this ?