NAME
ETL::Pipeline::Input::JsonFiles - Process JSON content from individual files
SYNOPSIS
use ETL::Pipeline;
ETL::Pipeline->new( {
input => ['JsonFiles', iname => qr/\.json$/i, records_at => '/json'],
mapping => {First => '/File/A', Second => '/File/Patient'},
output => ['UnitTest']
} )->process;
DESCRIPTION
ETL::Pipeline::Input::JsonFiles defines an input source that reads one or more records from one or more JSON files. Most of the time, there should be one record per file. But the class handles multiple records per file too.
METHODS & ATTRIBUTES
Arguments for "input" in ETL::Pipeline
records_at
Optional. The path to the record nodes, such as /json/Record
. The last item in the list is the name of the root for each individual record. The default is / - one record in the file.
You might use this attribute in two cases...
- 1. Multiple records per file. This is the top of each record, like in ETL::Pipeline::Input::Xml.
- 2. Shorthand to leave off extra nodes from every path. One record per file, but you don't want extra path parts on the beginning of every field.
This can be any value accepted by Data::DPath.
skipping
Not used. This attribute is ignored. JSON files must follow specific formatting rules. Extra rows are parsed as data. There's nothing to skip.
Methods
run
This is the main loop. It opens the file, reads records, and closes it when done. This is the place to look if there are problems.
ETL::Pipeline automatically calls this method.
SEE ALSO
ETL::Pipeline, ETL::Pipeline::Input, ETL::Pipeline::Input::File::List, JSON
AUTHOR
Robert Wohlfarth <robert.j.wohlfarth@vumc.org>
LICENSE
Copyright 2021 (c) Vanderbilt University Medical Center
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.