Cómo puedo combinar objetos jQuery juntosjQuery combinar dos objetos
tengo
{
"merchantcontract":"Ready Reserve Foods 10104.01",
"merchantcontractid":"c4253769-5a57-e111-b935-00155d010302",
"smi_transactiondate":"\/Date(1332140400000)\/",
"smi_glamount2":15.2600,
"smi_transactionclass":180870001,
"smi_transactionclassname":"Residual Agent Commission",
"smi_contractprodcutidname":"Traditional",
"smi_agentid":"1d3f44ee-afc3-e011-addf-a4badb1ddef5",
"smi_primaryagentid":"1d3f44ee-afc3-e011-addf-a4badb1ddef5"
},
{
"merchantcontract":"Ready Reserve Foods 10104.01",
"merchantcontractid":"c4253769-5a57-e111-b935-00155d010302",
"smi_transactiondate":"\/Date(1332140400000)\/",
"smi_glamount2":2.6000,
"smi_transactionclass":180870001,
"smi_transactionclassname":"Residual Agent Commission",
"smi_contractprodcutidname":"Traditional",
"smi_agentid":"1d3f44ee-afc3-e011-addf-a4badb1ddef5",
"smi_primaryagentid":"1d3f44ee-afc3-e011-addf-a4badb1ddef5"
}
me gustaría tener
{
"merchantcontract":"Ready Reserve Foods 10104.01",
"merchantcontractid":"c4253769-5a57-e111-b935-00155d010302",
"smi_transactiondate":"\/Date(1332140400000)\/",
"smi_glamount2":15.2600,
"smi_transactionclass":180870001,
"smi_transactionclassname":"Residual Agent Commission",
"smi_contractprodcutidname":"Traditional",
"smi_agentid":"1d3f44ee-afc3-e011-addf-a4badb1ddef5",
"smi_primaryagentid":"1d3f44ee-afc3-e011-addf-a4badb1ddef5"
},
{
"merchantcontract":"Ready Reserve Foods 10104.01",
"merchantcontractid":"c4253769-5a57-e111-b935-00155d010302",
"smi_transactiondate":"\/Date(1332140400000)\/",
"smi_glamount2":2.6000,
"smi_transactionclass":180870001,
"smi_transactionclassname":"Residual Agent Commission",
"smi_contractprodcutidname":"Traditional",
"smi_agentid":"1d3f44ee-afc3-e011-addf-a4badb1ddef5",
"smi_primaryagentid":"1d3f44ee-afc3-e011-addf-a4badb1ddef5"
}
{"merchantcontract":"Ready Reserve Foods 10104.01"{
"merchantcontractid":"c4253769-5a57-e111-b935-00155d010302",
"smi_transactiondate":"\/Date(1332140400000)\/",
"smi_glamount2":15.2600,
"smi_transactionclass":180870001,
"smi_transactionclassname":"Residual Agent Commission",
"smi_contractprodcutidname":"Traditional",
"smi_agentid":"1d3f44ee-afc3-e011-addf-a4badb1ddef5",
"smi_primaryagentid":"1d3f44ee-afc3-e011-addf-a4badb1ddef5"
},
{
"merchantcontractid":"c4253769-5a57-e111-b935-00155d010302",
"smi_transactiondate":"\/Date(1332140400000)\/",
"smi_glamount2":2.6000,
"smi_transactionclass":180870001,
"smi_transactionclassname":"Residual Agent Commission",
"smi_contractprodcutidname":"Traditional",
"smi_agentid":"1d3f44ee-afc3-e011-addf-a4badb1ddef5",
"smi_primaryagentid":"1d3f44ee-afc3-e011-addf-a4badb1ddef5"
}
}
Así que ambos objetos son menores de un objeto. Puedo tener más de dos objetos.
Los objetos se crean con cada uno en jquery.
No estoy seguro de cómo empezar a trabajar en esto.
Comprobar este post http://stackoverflow.com/questions/2454295/javascript-concatenate-properties-from-multiple-objects-associative-array para una posible respuesta. –