Can someone guide me on the best method for copying object properties from one object to another using AngularJS/JavaScript?
Here is an example of the JSON object I need help with:
{
"application":{
"number":"323-23-4231",
"amount":"234.44",
"ref_name":"Thomas Edison"
},
"borrower":{
"prefix":"Mr",
"first_name":"Eric",
"middle_name":"E",
"last_name":"Schulz",
"date_of_birth":"09/29/1975",
"email_address":"<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="a0cdd9c5cdc1c9cce0e8eff4ede1e9ec8ee3efed">[email protected]</a>",
"phones":[
{
"number":"(555)555-5555",
"type":"Mobile"
}
]
}
}
I am aiming to transform the above JSON object into a new structure that looks like this:
{
"number":"323-23-4231",
"amount":"234.44",
"ref_name":"Thomas Edison",
"prefix":"Mr",
"first_name":"Eric",
"middle_name":"E",
"last_name":"Schulz",
"date_of_birth":"09/29/1975",
"email_address":"<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="cda0b4a8a0aca4a18d858299808c8481e38e8280">[email protected]</a>",
"phones":[
{
"number":"(555)555-5555",
"type":"Mobile"
}
]
}