Forum Discussion

Deepti's avatar
Deepti
New Contributor II
2 years ago
Solved

Retrieve a list within another array list

Hi there, I have one input json like as follows: { "isValid": true, "logId": "9IE9BkOwxvrCwn_Ot7p4o-1699858392", "contractId": 1, "erpVendorId": "VID123", "erpVendorName": null...
  • koryknick's avatar
    2 years ago

    HI Deepti - update the second Mapper expression to the following:

    $items
    .map(x=> x.merge(
    { "additionalCoding" : { "workOrderNumber" : $project.projectId } 
    ,  "contractDetails" : { "workOrderNumber" : $project.projectId } }
    )
    )
    

    So rather than an Object.extend(), we'll use Object.merge() to do a deep merge of the object, allowing us to also add the workOrderNumber into the existing contractDetails sub-element.

    Hope this gets you closer to your goal!