Group
Extension

Matches 4

Catmandu-DBI ( N/NJ/NJFRANCK/Catmandu-DBI-0.13.tar.gz, NJFRANCK, 2024; MetaCPAN )
Catmandu-DBI/lib/Catmandu/Serializer/json_string.pm ( view source; MetaCPAN )
mandu::Serializer::json_string;

use Catmandu::Sane;
use JSON qw();
use Moo;

has json => (
    is       => "ro",
    lazy     => 1,
    init_arg => undef,
    default  => sub {JSON->new()->utf8(0);}
ze {
    $_[0]->json()->encode($_[1]);
}

sub deserialize {
    $_[0]->json()->decode($_[1]);
}

1;

__END__

=pod

=head1 NAME

Catmandu::Serializer - A (de)serializer from and to json strings

=head
1 DESCRIPTION

    serializer 'json' returns a binary utf-8 string,
    which only makes sense if you  send your data to column of type 'binary'

    use this serializer if your data column is a text 
Catmandu-DBI ( N/NJ/NJFRANCK/Catmandu-DBI-0.13.tar.gz, NJFRANCK, 2024; MetaCPAN )
Catmandu-DBI/lib/Catmandu/Store/DBI/Handler/Pg.pm ( view source; MetaCPAN )
'json') {
        if ($dbh->{pg_server_version} < 90400) {
            Catmandu::Error->throw(
                "JSONB type only supported in PostgreSQL 9.4 and above");
        }
        $sql .= 'JSON
;
    my %json_cols;
    for my $map (values %$mapping) {

        if ($map->{type} eq 'binary') {
            $binary_cols{$map->{column}} = 1;
        }
        elsif ($map->{type} eq 'json') {
    
type => DBD::Pg->PG_BYTEA});
        }
        elsif ($json_cols{$col}) {
            $sth->bind_param($i + 1, $val, {pg_type => DBD::Pg->PG_JSONB});
        }
        else {
            $sth->bind_pa
Catmandu-DBI ( N/NJ/NJFRANCK/Catmandu-DBI-0.13.tar.gz, NJFRANCK, 2024; MetaCPAN )
Catmandu-DBI/lib/Catmandu/Store/DBI.pm ( view source; MetaCPAN )
424

=head1 SYNOPSIS

    # From the command line
    $ catmandu import JSON to DBI --data_source SQLite:mydb.sqlite < data.json

    # Or via a configuration file
    $ cat catmandu.yml
    ---
    s
  $ catmandu import JSON to mydb < data.json
    $ catmandu export mydb to YAML > data.yml
    $ catmandu export mydb --id 012E929E-FF44-11E6-B956-AE2804ED5190 to JSON > record.json
    $ catmandu cou

Only MySQL, PostgreSQL

=item json

Only PostgreSQL

This is mapped internally to postgres field of type "jsonb".

Please use the serializer L<Catmandu::Serializer::json_string>,

if you choose to st
Catmandu-DBI ( N/NJ/NJFRANCK/Catmandu-DBI-0.13.tar.gz, NJFRANCK, 2024; MetaCPAN )
Catmandu-DBI/lib/Catmandu/DBI.pm ( view source; MetaCPAN )
andu import JSON to DBI --data_source dbi:SQLite:mydb.sqlite < data.json

    # Export data from a relational database
    $ catmandu export DBI --data_source dbi:SQLite:mydb.sqlite to JSON

    # Or 
import JSON to mydb < data.json
    $ catmandu export mydb to YAML > data.yml

    # Export one record
    $ catmandu export mydb --id 012E929E-FF44-11E6-B956-AE2804ED5190 to JSON > record.json

    #

Powered by Groonga
Maintained by Kenichi Ishigaki <ishigaki@cpan.org>. If you find anything, submit it on GitHub.