Forum Discussion
It looks like the value of content-location coming out of the Mapper is the file name minus the path.
If you were to put a Copy after the Mapper, followed by a Mapper to only use content-location (remap to FileName), then join it back at the JSON Splitter.
Thank you, Diane. Unfortunetly, FileName is not coming through after Json Parser and therefore, there is no way to get to it in JSON Splitter.
ZipFile Read produces following output:
JSON Parser follows directly after ZipFile Read and outputs only content of the data file itself:
Therefore, JSON Path does not have FileName:
Any ideas how I can pass FileName from ZipFile Read to JSON Parser and then to JSON Splitter?
Thank you!
- tstack7 years agoFormer Employee
(As you found out, using BinaryToDocument is one approach, I’m just offering another for reference)
I can offer a solution that is possible if you’re on the new 4.16 release. Since the JSONParser doesn’t pass through the header from the binary document, you can use a child pipeline to do the parsing and pass the filename as a pipeline parameter that can be referenced anywhere in the child pipeline. This approach is possible in 4.16 since the PipelineExecute snap can now support binary views.
You can switch the type of view by going into the “Views” tab and changing the value under the “Type” column for the given view:
So, your pipeline will look something like the following with the binary documents from the zip file going into a child pipeline:
And, the
$['content-location']
field containing the file name being passed as a parameter to the child execution in the PipelineExecute:The child pipeline would then have the JSONParser and a Mapper to add in the
$FileName
field:I’m attaching the parent and child pipelines as well:
ParseJsonWithFilename_2019_02_18.slp (4.5 KB)
ReadZipFileAndParse_2019_02_18.slp (3.7 KB) - dmiller7 years agoFormer Employee
Correct, it would not come through this way. My apologies for not including an image early. My intent was to collect the information earlier in the pipeline, Copy it out to a second branch, then join it back in with a Join or Union, whichever is appropriate for the data.
As @tstack said, there are several ways to do the same thing.
- Regina7 years agoNew Contributor II
Thank you, Diane and Tim! All information is very helpful