e OAuth::Lite2::Formatter::JSON;
use strict;
use warnings;
use parent 'OAuth::Lite2::Formatter';
use JSON;
use Try::Tiny;
sub name { "json" }
sub type { "application/json" };
sub format {
my
@_;
return JSON->new->encode($hash);
}
sub parse {
my ($self, $json) = @_;
return JSON->new->decode($json);
}
=head1 NAME
OAuth::Lite2::Formatter::JSON - OAuth 2.0 JSON formatters stor
matter = OAuth::Lite2::Formatter::JSON->new;
my $obj = $formatter->parse( $string );
$string = $formatter->format( $obj );
=head1 DESCRIPTION
OAuth 2.0 JSON formatter
=head1 METHODS
=head2
package Wiki::Toolkit::Plugin::JSON;
use strict;
use vars qw( $VERSION );
$VERSION = '0.05';
use JSON;
use POSIX 'strftime';
use Time::Piece;
use URI::Escape;
use Carp qw( croak );
sub new {
m
return $self->make_json( \@changes );
}
sub make_json {
my ( $self, $data ) = @_;
return JSON::to_json( $data );
}
1;
__END__
=head1 NAME
Wiki::Toolkit::Plugin::JSON - A Wiki::Toolkit
ges JSON.
=head1 DESCRIPTION
This is an alternative access to the recent changes of a Wiki::Toolkit
wiki. It outputs JSON.
=head1 SYNOPSIS
use Wiki::Toolkit;
use Wiki::Toolkit::Plugin::JSON;
package JSON::ON;
$VERSION = v0.0.3;
use warnings;
use strict;
use Carp;
=head1 NAME
JSON::ON - javascript object notation object notator
=head1 SYNOPSIS
This module serializes and deserializes b
ssed references with JSON.
use JSON::ON;
my $stuff = {whatever => What::Ever->new};
my $j = JSON::ON->new;
my $enc = $j->encode($stuff);
# elsewhere...
my $j = JSON::ON->new;
my $dec
->{whatever}->amethod;
=head2 Making Sausage
The encode() method installs a local UNIVERSAL::TO_JSON() which simply
un-blesses HASH, ARRAY, and SCALAR references. Similarly, the decoding
has a hook
est::WWW::Mechanize::JSON;
our $VERSION = 0.73;
use base "Test::WWW::Mechanize";
use Test::More;
use JSON::Any;
=head1 NAME
Test::WWW::Mechanize::JSON - Add a JSON and AJAXy methods to
e::JSON") or BAIL_OUT;
my $MECH = Test::WWW::Mechanize::JSON->new(
noproxy => 1,
etc => 'other-params-for-Test::WWW::Mechanize',
);
$MECH->get('http://example.com/json');
my $json_as
H->json_ok or BAIL_OUT Dumper $MECH->response;
$MECH->diag_json;
=head1 DESCRIPTION
Extends L<Test::WWW::Mechanize|Test::WWW::Mechanize>
to test JSON content in response bodies and C<x-json>
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";
package MonitisMonitorManager::Parsing::JSON;
use MonitisMonitorManager::M3PluginCommon;
use strict;
use JSON;
sub new {
my ($class, $name) = @_;
return undef;
}
# this function identifies the tok
sing
sub name {
return "json";
}
# matches all XML strings in the given output
sub parse {
my ($self, $metric_name, $metric_xml_path, $output, $results) = @_;
# handle JSON pattern matching
# eva
tch() block
eval {
my $json_presentation = from_json( $output, { utf8 => 1 } );
$self->match_strings_in_object($metric_name, $metric_xml_path, $json_presentation, "json", $results);
};
}
# mat
Tool::Bench::Report::JSON;
{
$Tool::Bench::Report::JSON::VERSION = '0.003';
}
use Mouse;
use JSON;
use List::Util qw{min max sum };
use Data::Dumper;
=head1 JSON
Builds a json report as follows (
n_time max_time total_time avg_time total_runs name note times }; #this is kinda janky
encode_json( [ map { my $item = $_;
my $x =
{ (
AME
Log::Message::JSON::Hash - L<Tie::IxHash(3)> wrapper supporting storing cache
=head1 SYNOPSIS
use Log::Message::JSON::Hash;
use JSON;
tie my %hash, "Log::Message::JSON::Hash";
# fill %
hash...
tied(%hash)->cache = encode_json(\%hash);
# ...
print tied(%hash)->cache;
=head1 DESCRIPTION
This class is a proxy to L<Tie::IxHash(3)>. It's a valid class to tie hash to,
and above
--------------------------------------------------------------------------
package Log::Message::JSON::Hash;
use warnings;
use strict;
use Tie::IxHash;
use Carp;
#---------------------------------
package Data::Pipeline::Adapter::JSON;
use Moose;
extends 'Data::Pipeline::Adapter';
use JSON;
use Data::Pipeline::Adapter::Array;
our $j = JSON -> new -> pretty -> utf8(1);
has '+preamble' => (
;
#
# TODO: make $data->{items} parameterized so we can use something other
# than Exhibit JSON files as input
#
my $source = Data::Pipeline::Adapter::Array -> new(
head1 NAME
Log::Message::JSON - structured messages that stringify to JSON
=head1 SYNOPSIS
package My::Application::Module;
use Log::Log4perl;
use Log::Message::JSON qw{logmsg};
sub do_so
, which
appenders could be in use and defeats much of Log::Log4perl's flexibility.
Log::Message::JSON is an attempt to solve this problem. Developer can create
a message that has an internal structur
f)), and at the
same time it can be used as a simple string, instantly serializing to
single-line JSON. This way the developer don't need to decide on appenders in
advance. Moreover, flat string logfi
ious::Coder::JSON;
use strict;
use warnings;
use JSON::MaybeXS ();
use 5.010;
# ABSTRACT: JSON encoder for AutodataHandler
our $VERSION = '1.29'; # VERSION
sub coder
{
my $json = JSON::MaybeXS->n
essed;
my %coder = (
type => 'application/json',
format => 'json',
encode => sub { $json->encode($_[0]) },
decode => sub { $json->decode($_[0]) },
);
\%coder;
}
1;
__END_
_
=pod
=encoding UTF-8
=head1 NAME
Clustericious::Coder::JSON - JSON encoder for AutodataHandler
=head1 VERSION
version 1.29
=head1 AUTHOR
Original author: Brian Duggan
Current maintainer: Gr
erialize::JSON::XS;
use Moose;
use namespace::autoclean;
BEGIN {
$ENV{'PERL_JSON_BACKEND'} = 2; # Always use compiled JSON::XS
}
extends 'Catalyst::Action::Deserialize::JSON';
use JSON::XS ();
package JSON::RPC::Client::Any;
use strict;
use warnings;
our $VERSION = 1.28;
our @ISA;
BEGIN {
if ( eval { require JSON::RPC::Legacy::Client } ) {
push @ISA, 'JSON::RPC::Legacy::Clie
( eval { require JSON::RPC::Client } ) {
push @ISA, 'JSON::RPC::Client';
}
else {
die "Unable to find JSON RPC Client implementation";
}
};
=head1 NAME
JSON::RPC::Client::An
-- wrap in an available JSON RPC Client implementation
=head1 SYNOPSIS
use JSON::RPC::Client::Any;
my $c = JSON::RPC::Client::Any->new()
...
=head1 DESCRIPTION
B<JSON::RPC::Client::Any> is a
Serialize::JSON::XS;
use Moose;
use namespace::autoclean;
BEGIN {
$ENV{'PERL_JSON_BACKEND'} = 2; # Always use compiled JSON::XS
}
extends 'Catalyst::Action::Serialize::JSON';
use JSON::XS ();
o
package Catalyst::Action::Serialize::JSON;
use Moose;
use namespace::autoclean;
extends 'Catalyst::Action';
use JSON ();
our $VERSION = '1.06';
$VERSION = eval $VERSION;
has encoder => (
is =>
'ro',
lazy_build => 1,
);
sub _build_encoder {
my $self = shift;
return JSON->new->utf8->convert_blessed;
}
sub execute {
my $self = shift;
my ( $controller, $c ) = @_;
my $sta
package Catalyst::Action::Deserialize::JSON;
use Moose;
use namespace::autoclean;
use Scalar::Util qw(openhandle);
extends 'Catalyst::Action';
use JSON;
our $VERSION = '1.06';
$VERSION = eval $VERS
( $rbody ) {
my $json = JSON->new->utf8;
if (my $options = $controller->{json_options}) {
foreach my $opt (keys %$options) {
$json->$opt( $options->{$opt}
);
}
}
my $rdata = eval { $json->decode( $rbody ) };
if ($@) {
return $@;
}
$c->request->data($rdata);
} else {
$c->log->deb
package MooseX::Storage::Format::JSON;
use Moose::Role;
no warnings 'once';
use JSON::Any;
use utf8 ();
our $VERSION = '0.32';
our $AUTHORITY = 'cpan:STEVAN';
requires 'pack';
requires 'unpack'
::encode($json) if utf8::is_utf8($json);
$class->unpack( JSON::Any->new->jsonToObj($json), @args );
}
sub freeze {
my ( $self, @args ) = @_;
my $json = JSON::Any->new->objToJson( $self->p
json) if !utf8::is_utf8($json) and utf8::valid($json); # if it's valid utf8 mark it as such
return $json;
}
no Moose::Role;
1;
__END__
=pod
=head1 NAME
MooseX::Storage::Format::JSON - A JSON
sto::Client::ContentHandlers::JSON;
BEGIN {
$App::Presto::Client::ContentHandlers::JSON::AUTHORITY = 'cpan:BPHILLIPS';
}
{
$App::Presto::Client::ContentHandlers::JSON::VERSION = '0.009';
}
# ABST
izing of JSON requests/responses
use Moo;
my $HAS_JSON;
BEGIN {
eval 'use JSON; $HAS_JSON = 1;'
}
sub can_deserialize {
my $self = shift;
my $content_type = shift;
return unless $HAS_JSON;
retur
~ m{^application/json}i;
}
sub deserialize {
my $self = shift;
my $content = shift;
my $ref;
eval { $ref = JSON::decode_json($content) || 1 } or do {
warn "Unable to parse JSON: $@";
};
retur
t::JSON;
{
$Net::HTTP::Spore::Middleware::Format::JSON::VERSION = '0.05';
}
# ABSTRACT: middleware for JSON format
use JSON;
use Moose;
extends 'Net::HTTP::Spore::Middleware::Format';
has _json_p
isa => 'JSON',
lazy => 1,
default => sub { JSON->new->utf8(1)->allow_nonref },
);
sub encode { $_[0]->_json_parser->encode( $_[1] ); }
sub decode { $_[0]->_json_parser->dec
> 'application/json' ) }
sub content_type { ( 'Content-Type' => 'application/json;' ) }
1;
__END__
=pod
=head1 NAME
Net::HTTP::Spore::Middleware::Format::JSON - middleware for JSON format
=head1
package JSON::Streaming::Writer::TestUtil;
# Just some utility bits for the test scripts to use.
use strict;
use warnings;
use base qw(Exporter);
use JSON::Streaming::Writer;
use Symbol;
our @EXPO
= qw(test_jsonw test_jsonw_croak);
sub test_jsonw {
my ($test_name, $correct_output, $code) = @_;
my $fh = JSON::Streaming::Writer::TestUtil::FakeHandle->new();
my $jsonw = JSON::Streami
m($fh);
$code->($jsonw);
my $actual_output = $fh->result;
Test::More::is($correct_output, $actual_output, $test_name) if defined($correct_output);
}
sub test_jsonw_croak {
my ($tes