I have two objects which I am trying to merge with different key The first object I need to compare with Id and my second object I need to compare with Option.
And My final expected output i have mentioned below
Apologize my bad formatting . I'm literally new to this forum. Please help.
Thanks in Advance.
My First Object
[
{
Category__c: "Option",
Description__c: "Exdoor",
Id: "a0F1e000000EgcGEAS",
Name: "with door"
},
{
Category__c: "Upgrade",
Description__c: "Exdoor",
Id: "a0F1e000000EgcHEAS",
Name: "Upgrade"
},
{
Category__c: "New Option",
Description__c: "1300 wide with doors",
Id: "a0F1e000000EgcIEAS",
Name: "doors"
},
{
Category__c: "Oven",
Description:"1450 Door",
Id: "a0F1e000000EgcJEAS",
Name: "Oven Option: Wall Oven"
}
]
My second Object
[
{
Option: "a0F1e000000EgcJEAS",
Price: 0
}
]
Now My expected output is
[
{
Category__c: "Option",
Description__c: "Exdoor",
Id: "a0F1e000000EgcGEAS",
Name: "with door"
},
{
Category__c: "Upgrade",
Description__c: "Exdoor",
Id: "a0F1e000000EgcHEAS",
Name: "Upgrade"
},
{
Category__c: "New Option",
Description__c: "1300 wide with doors",
Id: "a0F1e000000EgcIEAS",
Name: "doors"
},
{
Category__c: "Oven",
Description:"1450 Door",
Id: "a0F1e000000EgcJEAS",
Price: 0,
Name: "Oven Option: Wall Oven"
}
]