cancel
Showing results for 
Search instead for 
Did you mean: 

Mapper for nest array

pavan_gangisett
New Contributor II

I’m trying transform the data as below using mapper. Could someone please let me know how this can be done with mapper snap.
Input Schema:
[
department_Id: number,
details: [
{ firstname: string, lastname: string, id: number},
{ firstname: string, lastname: string, id: number}
]
]

Expected Output Schema:
[
department_Id: number,
details: [
{ name: string = firstname+ " "+ lastname, id: number},
{ name: string = firstname+ " "+ lastname, id: number}
]
]

1 ACCEPTED SOLUTION

Think this does what you’re looking for.

image

I used the first mapper to re-map the entries in the details array and then the second mapper to rename the details property to users.

Here is what I was mentioning about using the Mapping Root. This is very helpful for working with nested arrays.

28%20AM

Here is the complete example for you to try out. Good luck with your work.

make-users_2019_06_20.slp (5.5 KB)

View solution in original post

6 REPLIES 6

Think this does what you’re looking for.

image

I used the first mapper to re-map the entries in the details array and then the second mapper to rename the details property to users.

Here is what I was mentioning about using the Mapping Root. This is very helpful for working with nested arrays.

28%20AM

Here is the complete example for you to try out. Good luck with your work.

make-users_2019_06_20.slp (5.5 KB)

Thanks. It is working as expected