I retrieve two separate JSON objects (one ticket and its articles) from an API. How can I combine them into one structure in n8n using JavaScript?
const mergeObjects = (ticketInfo, articleList) => ({
Record: ticketInfo,
details: articleList
});
const ticketInfo = { id: 101, title: 'Example Ticket', status: 'open' };
const articleList = [
{ id: 201, comment: 'First response' },
{ id: 202, comment: 'Follow-up message' }
];
console.log(mergeObjects(ticketInfo, articleList));