sformations
=head1 SYNOPSIS
# From the command line
$ catmandu convert JSON --fix 'add(foo,bar)' < data.json
$ catmandu convert YAML --fix 'upcase(job) remove(test)' < data.yml
$ ca
-fix /tmp/myfixes.txt
# With preprocessing
$ catmandu convert JSON --var field=foo --fix 'add({{field}},bar)' < data.json
# From Perl
use Catmandu;
my $fixer = Catmandu->fixer(
is command is executed on the command line:
$ catmandu convert JSON --fix 'upcase(title); add(deep.nested.field,1)' < data.json
then all the title fields will be upcased and a new deeply nested
he commandline
$ catmandu convert JSON --fix myfixes to Null < /tmp/data.json
$ catmandu convert JSON --fix 'add_to_exporter(.,JSON)' to Null < /tmp/data.json
=head1 DESCRIPTION
This exporter
< data.xls
$ catmandu convert JSON to CSV --fix myfixes.txt --sep_char ';' < data.json
# Provide a hint to the exporter which fields to export from the JSON
# input. By default the CSV e
will export the fields that are
# found in the first JSON record.
$ catmandu convert JSON to CSV --fields "id,title,year" < data.json
# In a Perl script
use Catmandu;
my $expor
ove_field(n,brol)
add_to_exporter(.,JSON)
do importer(Mock,size:20,step:true)
move_field(n,m)
add_to_exporter(.,JSON)
end
end
=head1 SEE ALSO
L<C
xt
add_field(my_source,{{source}})
# Or create an execurable fix script:
#!/usr/bin/env catmandu run
do importer(Mock,size:10)
add_field(foo,bar)
add_to_exporter(.,JSON)
end
=cut
V data
=head1 SYNOPSIS
# From the command line
# convert a CSV file to JSON
catmandu convert CSV to JSON < journals.csv
# set column names if CSV file has no header line
echo '
catmandu convert <IMPORTER> <OPTIONS> to <EXPORTER> <OPTIONS>
cat books.json | catmandu convert JSON to CSV --fields id,title
catmandu help importer JSON
catmandu help exporter YAML
=cut
atmandu->exporter('JSON', pretty => 1, array => 0);
}
1;
__END__
=pod
=head1 NAME
Catmandu::Cmd::config - export the Catmandu config
=head1 EXAMPLES
# export config to JSON
catmandu config
.
if (@$args == 2) {
# detect many forms such as:
# export JSON, exporter JSON, JSON export, JSON exporter
foreach (0, 1) {
foreach my $type (keys %MODULES) {
ME>";
}
1;
__END__
=pod
=head1 NAME
Catmandu::Cmd::help - show help
=head1 EXAMPLES
catmandu help convert
catmandu help import JSON
catmandu help help
catmandu help fix set_field
=cut
values
=head1 SYNOPSIS
# From the command line
# convert a TSV file to JSON
catmandu convert TSV to JSON < journals.tab
# Or in a Perl script
use Catmandu;
my $importer =
to a schema
select valid('', JSONSchema, schema: "my/schema.json")
# check the author field
unless valid(author, JSONSchema, schema: "my/author.schema.json")
... # repair or give w
catmandu info --stores
catmandu info --validators
catmandu info --namespace=Catmandu
catmandu info --all
# export list of exporter modules to JSON
catmandu info --exporters to JSON
=cut
t imports YAML data
=head1 SYNOPSIS
# From the command line
$ catmandu convert YAML to JSON < data.yaml
# In a Perl script
use Catmandu;
my $importer = Catmandu->importer('YA
SH key or ARRAY index by replacing
its value with imported data
=head1 SYNOPSIS
import(foo.bar, JSON, file: "http://foo.com/bar.json", data_path: data.*)
=head1 SEE ALSO
L<Catmandu::Fix>
=cut
at counts things
=head1 SYNOPSIS
# From the commandline
$ catmandu convert JSON to Count < /tmp/data.json
=head1 DESCRIPTION
This exporter exports nothing and just counts the number of it
data:
plugins:
- Datestamps
$ echo '{"hello":"world"}' | catmandu import JSON to test
$ catmandu export test to YAML
---
_id: ADA305D8-697D-11E3-B0C3-97AD572FA7E3
date_cre
t anything
=head1 SYNOPSIS
# From the commandline
$ catmandu convert JSON --fix myfixes to Mock < /tmp/data.json
# From Perl
use Catmandu;
# Print to STDOUT
my $exporter =
IPTION
Catmandu::Fix::SimpleGetValue eases the creation of emit Fixes that transform
values on a JSON path. A Fix package implementing Catmandu::Fix::SimpleGetValue
needs to implement a method C<emit
atmandu::Fix. The method should
return a string containing the Perl code to transform values on a JSON path.
It is not possible to inspect in an emit Fix the actual value on which this Fix
runs: $var
store
$ echo '{"_id":"001",hello":"world"}' | catmandu import JSON to test
$ echo '{"_id":"001",hello":"world2"}' | catmandu import JSON to test
# In the store we see only the latest version
$ ca
orter.
=head1 SYNOPSIS
#BEFORE: { 'json' => '[{"name":"Nicolas"}]' }
#AFTER: { 'json' => [{"name":"Nicolas"}] }
import_from_string('json','JSON')
#BEFORE: { record => qq(first_nam
choose:
* full package name of the importer (e.g. 'Catmandu::Importer::JSON')
* short package name of the importer (e.g. 'JSON')
* name of the importer as declared in the Catmandu configuration
=i