Group
Extension

Matches 1

Flux-Format-JSON ( M/MM/MMCLERIC/Flux-Format-JSON-1.01.tar.gz, MMCLERIC, 2013; MetaCPAN )
Flux-Format-JSON/lib/Flux/Format/JSON.pm ( view source; MetaCPAN )
age Flux::Format::JSON;

# ABSTRACT: JSON format for flux storages

=head1 SYNOPSIS

    use Flux::Format::JSON;

    my $json_storage = Flux::Format::JSON->wrap($storage);
    $json_storage->write({ 
ding with \n

    my $in = $json_storage->in(...);
    $in->read; # { foo => "bar" }

=cut

use Moo;
with 'Flux::Format';

use JSON;

use Flux::Simple qw(mapper);

has 'json' => (
    is => 'lazy',
  
 => sub {
        return JSON->new->utf8->allow_nonref;
    },
);

sub encoder {
    my $self = shift;

    return mapper {
        my $item = shift;
        return $self->json->encode($item)."\n";
  

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