Catmandu::Importer::JSON(3pm) | User Contributed Perl Documentation | Catmandu::Importer::JSON(3pm) |
Catmandu::Importer::JSON - Package that imports JSON data
# From the command line $ catmandu convert JSON to YAML < data.json # or for faster newline delimited input $ catmandu convert JSON --line_delimited 1 to YAML < data.json # In a Perl script use Catmandu; my $importer = Catmandu->importer('JSON', file => "/foo/bar.json"); my $n = $importer->each(sub { my $hashref = $_[0]; # ... });
This package imports JSON data. The parser is quite liberal in the input it accepts. You can use the "line_delimited" option to parse "newline delimited JSON" faster:
{ "recordno": 1, "name": "Alpha" } { "recordno": 2, "name": "Beta" } { "recordno": 3, "name": "Gamma" }
Every Catmandu::Importer is a Catmandu::Iterable all its methods are inherited. The methods are not idempotent: JSON streams can only be read once.
Catmandu::Exporter::JSON
2023-03-03 | perl v5.36.0 |