Group
Extension

Matches 6

Raisin ( R/RT/RTKH/Raisin-0.94.tar.gz, RTKH, 2022; MetaCPAN )
Raisin/lib/Raisin/Encoder/JSON.pm ( view source; MetaCPAN )
r::JSON
#ABSTRACT: JSON serialization plugin for Raisin.

use strict;
use warnings;

package Raisin::Encoder::JSON;
$Raisin::Encoder::JSON::VERSION = '0.94';
use JSON::MaybeXS qw();

my $json = JSON::
ation/json text/x-json text/json json)] }

sub content_type { 'application/json; charset=utf-8' }

sub serialize { $json->allow_blessed->convert_blessed->encode($_[1]) }

sub deserialize { $json->allo
d->decode($_[1]->content) }

1;

__END__

=pod

=encoding UTF-8

=head1 NAME

Raisin::Encoder::JSON - JSON serialization plugin for Raisin.

=head1 VERSION

version 0.94

=head1 DESCRIPTION

Provides 
Raisin ( R/RT/RTKH/Raisin-0.94.tar.gz, RTKH, 2022; MetaCPAN )
Raisin/lib/Raisin/Middleware/Formatter.pm ( view source; MetaCPAN )
ncoder'} >>. Occasionally the application will want to
change the format, for example to return a JSON error response from a
route that normally returns plain text. To do that, change
C<< env->{'rasin
Raisin ( R/RT/RTKH/Raisin-0.94.tar.gz, RTKH, 2022; MetaCPAN )
Raisin/lib/Raisin/Decoder.pm ( view source; MetaCPAN )
ecoder::VERSION = '0.94';
use parent 'Raisin::Encoder';

sub builtin {
    {
        json => 'Raisin::Encoder::JSON',
        yaml => 'Raisin::Encoder::YAML',
        form => 'Raisin::Encoder::Form',
   my $dec = Raisin::Decoder->new;
    $dec->register(xml => 'Some::XML::Parser');
    $dec->for('json');
    $dec->media_types_map_flat_hash;

=head1 DESCRIPTION

Provides an easy interface to use an
uiltin

Returns a list of encoders which are bundled with L<Raisin>.
They are: L<Raisin::Encoder::JSON>, L<Raisin::Encoder::YAML>.

=head1 AUTHOR

Artur Khabibullin

=head1 COPYRIGHT AND LICENSE

This
Raisin ( R/RT/RTKH/Raisin-0.94.tar.gz, RTKH, 2022; MetaCPAN )
Raisin/lib/Raisin/Encoder.pm ( view source; MetaCPAN )
ass) = @_;
    $self->{registered}{$format} = $class;
}

sub builtin {
    {
        json => 'Raisin::Encoder::JSON',
        yaml => 'Raisin::Encoder::YAML',
        text => 'Raisin::Encoder::Text',
my $enc = Raisin::Encoder->new;
    $enc->register(xml => 'Some::XML::Formatter');
    $enc->for('json');
    $enc->media_types_map_flat_hash;

=head1 DESCRIPTION

Provides an easy interface to use an
ence.

    $enc->register(json => 'My::Own::JSON::Formatter');

=head2 builtin

Returns a list of encoders which are bundled with L<Raisin>.
They are: L<Raisin::Encoder::JSON>, L<Raisin::Encoder::Text
Raisin ( R/RT/RTKH/Raisin-0.94.tar.gz, RTKH, 2022; MetaCPAN )
Raisin/lib/Raisin/Plugin/Swagger.pm ( view source; MetaCPAN )
aisin::Plugin';

use Carp 'croak';
use Data::Dumper;
use Digest::MD5 qw/md5_hex/;
use JSON::MaybeXS qw/encode_json/;
use List::Util qw/pairmap/;
use Scalar::Util qw(blessed);

my %DEFAULTS;
my %SETTIN
 @content_types = $app->format
        ? $app->format
        : qw(application/x-yaml application/json);

    my $base_path = $req->base->as_string;
    ### Respect proxied requests
    #   A proxy ma
cation,
            name        => $p->name,
            required    => $p->required ? JSON::MaybeXS::true : JSON::MaybeXS::false,
            %$ptype,
        );
        $param{default} = $p->default
Raisin ( R/RT/RTKH/Raisin-0.94.tar.gz, RTKH, 2022; MetaCPAN )
Raisin/lib/Raisin.pm ( view source; MetaCPAN )
};

=head3 produces

Specifies the content types produced by C<resource>.

    produces ['text', 'json'];

The argument is an array reference of strings corresponding to the
keys used by C<register_en
 asked without an extension (C<json>, C<yaml>) or C<Accept> header
isn't specified the default format will be used.

Default value: C<YAML>.

    api_default_format 'json';

See also L<Raisin/API-FORM
exists L<Raisin::Encoder::JSON>, L<Raisin::Encoder::YAML>,
and L<Raisin::Encoder::Text>, but you can always register your own
using L</register_encoder>.

    api_format 'json';

See also L<Raisin/API

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