# Managing complete objects in json

**URL:** <https://community.postman.com/t/managing-complete-objects-in-json/62031>\
**Category:** Help Hub\
**Tags:** tests, postman-flows\
**Created:** [June 10, 2024, 12:38pm UTC](https://community.postman.com/t/managing-complete-objects-in-json/62031 "2024-06-10T12:38:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![miguelpeccin](https://avatars.discourse-cdn.com/v4/letter/m/ad7895/32.png) [@miguelpeccin](https://community.postman.com/u/miguelpeccin)\
**Post date:** [June 10, 2024, 12:38pm UTC](https://community.postman.com/t/managing-complete-objects-in-json/62031/1 "2024-06-10T12:38:46Z")

</div>

Hi! I’m new at postman flows and at this moment i’m trying to get info from severals apis. From one of them i got this workflows, levels and groups

[  
[  
{  
“workflow”: 39,  
“description”: “sector de administracion”,  
“level”: [  
{  
“workflow”: 39,  
“level”: 1,  
“groups”: [  
63  
]  
},  
{  
“workflow”: 39,  
“level”: 2,  
“groups”: [  
35  
]  
},  
{  
“workflow”: 39,  
“level”: 3,  
“groups”: [  
27  
]  
}  
]  
}  
],  
…

from other i got groups and users

[  
{  
“group”: 25,  
“description”: “Grupo 1”,  
“users”: [  
“User1”  
]  
},  
{  
“group”: 24,  
“description”: “Grupo 1b”,  
“users”: [  
“User2”,  
“User3”  
]  
},  
…

How can y get some similiat to

[  
[  
{  
“workflow”: 39,  
“description”: “Administracion y Finanzas”,  
“with\_oc”: “0.00”,  
“without\_oc”: “0.00”,  
“level”: [  
{  
“workflow\_level”: 126,  
“workflow”: 39,  
“level”: 1,  
“approvers\_quantity”: 1,  
“groups”: [  
{  
“group”: 63,  
“description”: “Grupo63”,  
“users”: [  
“User1”  
]  
}  
]  
},  
{  
“workflow\_level”: 127,  
“workflow”: 39,  
“level”: 2,  
“approvers\_quantity”: 1,  
“groups”: [  
{  
“group”: 35,  
“description”: “Grupo65”,  
“users”: [  
“User2”  
]  
}  
]  
},  
{  
“workflow\_level”: 128,  
“workflow”: 39,  
“level”: 3,  
“approvers\_quantity”: 1,  
“groups”: [  
{  
“group”: 27,  
“description”: “Grupo27”,  
“users”: [  
“userGrupo27”  
]  
}  
]  
}  
]  
}  
],  
…

I need to join those complex objetcs into one! …  
I confuse using $map or $merge… I cant do it… I think I need to iterate every json list with foreach but in fact i cant find foreach as a block in postman flows.

Someone can help me please?

thanks a lot!

---

<div class="post-metadata">

**Author:** ![lunar-module-1](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/lunar-module-1/32/26132_2.png) [@lunar-module-1](https://community.postman.com/u/lunar-module-1)\
**Post date:** [June 10, 2024, 4:30pm UTC](https://community.postman.com/t/managing-complete-objects-in-json/62031/2 "2024-06-10T16:30:34Z")

</div>

Do you know how to express this in JavaScript/TypeScript? If so, try the evaluate block with TypeScript mode. There’s a little drop down arrow in the top right of the evaluate block to change the input language.

---

<div class="post-metadata">

**Author:** ![flows-daniel](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/flows-daniel/32/25516_2.png) [@flows-daniel](https://community.postman.com/u/flows-daniel)\
**Post date:** [June 10, 2024, 4:48pm UTC](https://community.postman.com/t/managing-complete-objects-in-json/62031/3 "2024-06-10T16:48:14Z")

</div>

@miguelpeccin

Adding similar post with TypeScript and FQL solutions 🙂

> [@Joining lists by shared property](https://community.postman.com/t/joining-lists-by-shared-property/59969/6):
>
> Adding TypeScript solution below that will produce the same result: interface Item { Id: string; GTIN?: string; Color?: string; Material?: string; Grams?: number; } function joinLists(list1: Item[], list2: Item[]): Item[] { const joinedList: Item[] = []; list1.forEach(item1 =\> { const matchingItem = list2.find(item2 =\> item2.Id === item1.Id); if (matchingItem) { joinedList.push({ ...item1, Material: matchi…

Let us know if you get stuck on anything.

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/system/32/29796_2.png) [@system](https://community.postman.com/u/system)\
**Post date:** [July 10, 2024, 4:48pm UTC](https://community.postman.com/t/managing-complete-objects-in-json/62031/4 "2024-07-10T16:48:57Z")

</div>

Closed on July 10, 2024, 4:48pm UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
