Forum Discussion

lake's avatar
lake
New Contributor
11 months ago
Solved

Array of objects manipulation

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"
]
}
]
}
]

  • 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.

    Let me know if you have any questions.

    Best regards,

    Aleksandar.

1 Reply

  • 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.

    Let me know if you have any questions.

    Best regards,

    Aleksandar.