Open ankitravan opened 4 years ago
[{ "operation": "shift", "spec": { "array1": { "": { "array2": { "": { "@": "[]" } } } }
}
}, { "operation": "shift", "spec": { "*": { "employeeId": "[&1].employeeId", "employeeI2": "[&1].employeeGlobalId" }
}
}]
Hi niernier007,
Could you explain how it is working for you. Because it returns null while i am trying to transform same above input with this code.
I have 2 nested arrays inside a parent array , and I need to line up the objects in each using the "employeeId" value.
Input : { "array1": [ { "array2": [ { "employeeId": 3108060, "employeeI2": 3108061 }, { "employeeId": 3107507, "employeeI2": 3108062 } ] }, { "array2": [ { "employeeId": 5018234, "employeeI2": 3108063 }, { "employeeId": 5002358, "employeeI2": 3108064 }, { "employeeId": 1630768, "employeeI2": 3108065 }, { "employeeId": 5022945, "employeeI2": 3108066 }, { "employeeId": 5005768, "employeeI2": 3108067 } ] } ] }
Required Output [ { "employeeId" : 3108060, "employeeGlobalId" : 3108061 }, { "employeeId" : 3107507, "employeeGlobalId" : 3108062 }, { "employeeId" : 5018234, "employeeGlobalId" : 3108063 }, { "employeeId" : 5002358, "employeeGlobalId" : 3108064 }, { "employeeId" : 1630768, "employeeGlobalId" : 3108065 }, { "employeeId" : 5022945, "employeeGlobalId" : 3108066 }, { "employeeId" : 5005768, "employeeGlobalId" : 3108067 } ]