cancel
Showing results for 
Search instead for 
Did you mean: 

Array of objects manipulation

lake
New Contributor

Hi team,

I would like to iterate thru an array of objects and verify if the objects has same num, code and date with different boxNumbers, then I should add the boxNumbers together and make that as a single object. If those three didn't match I should leave the object as is. Could you please help me on this?
Sample Input data:
[
{
"product": [
{
"num": "69315013901",
"code": "C06024",
"date": "2026-03-31",
"boxNumber": [
"453215578875",
"964070610419"
]
},
{
"num": "69315013901",
"code": "C06024",
"date": "2026-03-31",
"boxNumber": [
"153720699865",
"547398527901",
"994797055803"
]
},
{
"num": "69315030805",
"code": "083L022",
"date": "2025-11-30",
"boxNumber": [
"VUANJ6KYSNB",
"DPPG4NWK695"
]
}
]
}
]

Expected Output:

[
{
"product": [
{
"num": "69315013901",
"code": "C06024",
"date": "2026-03-31",
"boxNumber": [
"453215578875",
"964070610419",
"153720699865",
"547398527901",
"994797055803"
]
},
{
"num": "69315030805",
"code": "083L022",
"date": "2025-11-30",
"boxNumber": [
"VUANJ6KYSNB",
"DPPG4NWK695"
]
}
]
}
]

1 ACCEPTED SOLUTION

Aleksandar_A
Contributor III

Hello @lake,

Attached is the sample pipeline for structuring the data as needed:

  1. Split the ndc array.
  2. Sort and group by num, lotNum, and expDate.
  3. Consolidate serialNumber.
  4. Reassemble the ndc array.

Aleksandar_A_0-1723621021114.png

Let me know if you have any questions.

Best regards,

Aleksandar.

View solution in original post

1 REPLY 1

Aleksandar_A
Contributor III

Hello @lake,

Attached is the sample pipeline for structuring the data as needed:

  1. Split the ndc array.
  2. Sort and group by num, lotNum, and expDate.
  3. Consolidate serialNumber.
  4. Reassemble the ndc array.

Aleksandar_A_0-1723621021114.png

Let me know if you have any questions.

Best regards,

Aleksandar.