Skip to content
This repository has been archived by the owner on Dec 4, 2018. It is now read-only.

Modify nested array and retain all top-level properties in piped output #113

Open
jcready opened this issue Nov 27, 2016 · 2 comments
Open

Comments

@jcready
Copy link

jcready commented Nov 27, 2016

Is it possible to use these new header/footer events to take JSON data like in #93 and pipe it to a write stream such that we can modify each object in the records array but also include the rest of the top-level properties in the final output piped to the write stream?

@dominictarr
Copy link
Owner

sure, I guess you could make a json transform stream which handled those specially somehow.

@jcready
Copy link
Author

jcready commented Dec 5, 2016

@dominictarr could you possibly provide a simple example of how to do something like this? I essentially just want to be able to mutate part of the stream inline. The only thing I seem to be able to do is have it get and make changes to each item in the records array, but then the output is just the records array. I cannot figure out how to make changes to each item in the records array and output the entire top-level structure of the input while including the mutations I made to the records array.

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants