Forum Discussion
Hi,
To copy a field from the root object into the child objects, try a combination of the map
and extend
functions of the expression language:
Here’s another variant that just uses map
and an object literal which both copies the date
and renames the index
to lineNum
:
Yes, this works. I just wanted to see if there was a standard snap that would be more straight-forward and to make sure there aren’t any performance concerns with using map and extend.
- ptaylor5 years agoEmployee
Depending on your use case, it might be possible to use the JSON Splitter instead. It can split the child array into separate output documents, and copy any desired fields from the parent (using
Include Paths
) or all of the parent’s fields (usingInclude scalar parents
). But I wouldn’t worry about a potential performance with Mapper unless you observe an actual performance issue with Mapper.Hope that helps.
- wcl3y25 years agoNew Contributor III
Sounds good, thanks for your help!