Zolf
asked on
Manipulate JSON Array in Angular
Hi there,
I have this two Array and want to get some of the values from one array into another. Can someone please help.
I want to get the rawmaterialwh array's supplier and rawmaterialid and insert it in the newData's rawmaterialwh array,so that my newData JSON aray will look like so,
I have this two Array and want to get some of the values from one array into another. Can someone please help.
newData {"id":10,"receiptno":"777","contractmfg":4,"entrydate":"2020-09-04","rawmaterialwh":[{"qty":100},{"qty":20}]}
oldData {"id":10,"receiptno":"777","contractmfg":4,"entrydate":"2020-09-04","rawmaterialwh":[{"supplier":5,"rawmaterialid":16,"qty":10},{"supplier":11,"rawmaterialid":8,"qty":20}]}
I want to get the rawmaterialwh array's supplier and rawmaterialid and insert it in the newData's rawmaterialwh array,so that my newData JSON aray will look like so,
transformedData {"id":10,"receiptno":"777","contractmfg":4,"entrydate":"2020-09-04","rawmaterialwh":[{"supplier":5,"rawmaterialid":16,"qty":100},{"supplier":11,"rawmaterialid":8,"qty":20}]}
Thanks!!
ASKER
Thanks for your comments.
It is populating the newData with the supplier and rawmaterialid but it is also loading the old qty instead of the newData
It is populating the newData with the supplier and rawmaterialid but it is also loading the old qty instead of the newData
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks a lot.
welcome...
newData.rawmaterialwh = oldData.rawmaterialwh;