istHub::Web::View::JSON;
use strict;
use base 'Catalyst::View::JSON';
use JSON::XS ();
__PACKAGE__->config(
allow_callback => 0,
expose_stash => 'json',
no_x_json_header => 1,
);
oder} = JSON::XS->new->latin1;
$self;
}
sub encode_json {
my ($self, $c, $data) = @_;
$self->{encoder}->encode($data);
}
=head1 NAME
App::HistHub::Web::View::JSON - Catalyst JSON View
=head1 SYNOPSIS
See L<App::HistHub::Web>
=head1 DESCRIPTION
Catalyst JSON View.
=head1 AUTHOR
Daisuke Murase
=head1 LICENSE
This library is free software, you can redistribute it and/or modify
::JSON;
use 5.006;
use strict;
use warnings;
our $VERSION = '0.02';
our $AUTHORITY = 'cpan:STEVAN';
1;
__END__
=head1 NAME
JS::JSON - JSON module for JS
=head1 SYNOPSIS
http://www.json.o
.json.org/json2.js> for use with the
L<JS> framework.
=head1 DOCUMENTATION
This file creates a global JSON object containing two methods: stringify
and parse.
=head1 METHODS
=over 4
=item B<JSON
duces a JSON text from a JavaScript value.
When an object value is found, if the object contains a toJSON
method, its toJSON method will be called and the result will be
stringified. A toJSON method
package RPC::JSON::Shell;
use warnings;
use strict;
use vars qw|$VERSION @EXPORT $DEBUG $META $AUTOLOAD|;
$VERSION = '0.02';
@RPC::JSON::Shell = qw|Exporter|;
use RPC::JSON;
use Term::ReadLine;
u
ME
RPC::JSON::Shell - Interactive JSON-RPC Shell
=head1 SYNOPSIS
perl -MRPC::JSON -e "RPC::JSON::shell"
Not connected> connect http://www.dev.simplymapped.com/services/geocode/json.smd
DC 20004, USA'
}
];
=head1 DESCRIPTION
This module is an interactive client to a JSON-RPC service. It is currently
in its infancy and is likely to be very unstable. There are many b
package RPC::JSON;
use warnings;
use strict;
use RPC::JSON::Shell;
use Carp;
use JSON;
use LWP::UserAgent;
use URI;
use URI::Heuristic qw(uf_uri);
use vars qw|$VERSION @EXPORT $DEBUG $META $AUTOL
:JSON = qw|Exporter|;
@EXPORT = qw|
shell
test
|;
our $REQUEST_COUNT = 1;
=head1 NAME
RPC::JSON - JSON-RPC Client Library
=head1 SYNOPSIS
use RPC::JSON;
my $jsonrpc = RPC::JSON-
>new(
"http://www.simplymapped.com/services/geocode/json.smd" );
# Imports a geocode(['address']) method:
$jsonrpc->geocode('1600 Pennsylvania Ave');
Dumping this function returns wh
package Mirror::JSON::URI;
use 5.005;
use strict;
use URI ();
use Params::Util qw{ _STRING _INSTANCE };
use LWP::Simple ();
use vars qw{$VERSION};
BEGIN {
$VERSION = '0.01';
}
######
elf->uri, 'URI') ) {
return undef;
}
return $self;
}
sub uri {
$_[0]->{uri};
}
sub json {
$_[0]->{json};
}
sub live {
!! $_[0]->{live};
}
sub lag {
$_[0]->{lag};
}
###################
shift;
my $uri = URI->new('mirror.json')->abs( $self->uri );
my $before = Time::HiRes::time();
my $json = LWP::Simple::get($uri);
unless ( $json and $json =~ /^---/ ) {
# Site does not exis
package Mirror::JSON;
use 5.005;
use strict;
use Carp qw{ croak };
use Params::Util qw{ _STRING _POSINT _ARRAY0 _INSTANCE };
use JSON ();
use URI ();
use
Time::HiRes ();
use Time::Local ();
use LWP::Simple ();
use Mirror::JSON::URI ();
use constant ONE_DAY => 86700; # 1 day plus 5 minutes fudge factor
use constant TWO_DAYS =>
';
}
#####################################################################
# Wrapper for the JSON::Tiny methods
sub new {
my $class = shift;
my $self = bless { @_ }, $class;
if ( _STRING($se
package POE::Component::Client::REST::JSON;
use JSON;
use Moose;
our $VERSION = '0.05';
extends q(POE::Component::Client::REST);
sub cook_request {
my $request = $_[0];
if(my $content = $reques
t->content) {
$content = encode_json($content);
$request->content_type('application/json');
$request->content($content);
$request->header('Content-Encoding' => 'UTF-8');
};
return
e_json($response->content), $response);
};
has '+response_cooker' => (default => sub { \&cook_response });
1;
__END__
=head1 NAME
POE::Component::Client::REST::JSON - Low-level interface for JSON
package RDF::Server::Formatter::JSON;
use Moose;
with 'RDF::Server::Formatter';
use MooseX::Types::Moose qw(ArrayRef Str);
use RDF::Server::Constants qw(:ns);
use JSON::Any;
use RDF::Server::Excepti
communicate the mime type
our $JSON = JSON::Any -> new;
sub wants_rdf { 0 }
###
# Entry / Resource formatting
###
sub resource { return ( 'application/json', $JSON -> encode($_[1]) ); }
sub to_r
y $data = $JSON -> decode( $content );
# now make RDF from the data structure
}
###
# List formatting
###
sub feed {
my($self, @list) = @_;
return( 'application/json', $JSON -> encode(
atalystX::Example::YUIUploader::View::JSON;
use strict;
use base 'Catalyst::View::JSON';
=head1 NAME
CatalystX::Example::YUIUploader::View::JSON - Catalyst JSON View
=head1 SYNOPSIS
See L<Catalys
tX::Example::YUIUploader>
=head1 DESCRIPTION
Catalyst JSON View.
=head1 AUTHOR
A clever guy
=head1 LICENSE
This library is free software, you can redistribute it and/or modify
it under the same
package JSON::RPC::Server::FastCGI;
use warnings;
use strict;
use CGI::Fast;
use base qw(JSON::RPC::Server::CGI);
=head1 NAME
JSON::RPC::Server::FastCGI - A FastCGI version of JSON::RPC::Server
=h
ead1 VERSION
Version 0.03
=cut
our $VERSION = '0.03';
=head1 SYNOPSIS
use JSON::RPC::Server::FastCGI;
use lib 'libs/'; # you could put your handler modules here
# If you want to use an
'External' FastCGI Server:
# $ENV{FCGI_SOCKET_PATH} = "elsewhere:8888";
my $server = JSON::RPC::Server::FastCGI->new;
$server->dispatch_to('MyApp')->handle();
=head1 CONSTRUCTOR
=head2 new
package JSON::XS::VersionOneAndTwo;
use strict;
no strict 'refs';
use warnings;
use JSON::XS;
our $VERSION = '0.31';
sub import {
my ( $exporter, @imports ) = @_;
my ( $caller, $file, $line )
$json_xs_version = $JSON::XS::VERSION;
if ( $json_xs_version < 2.01 ) {
*{ $caller . '::encode_json' } = \&JSON::XS::to_json;
*{ $caller . '::to_json' } = \&JSON::XS::to_json;
. '::decode_json' } = \&JSON::XS::from_json;
*{ $caller . '::from_json' } = \&JSON::XS::from_json;
} else {
*{ $caller . '::encode_json' } = \&JSON::XS::encode_json;
*{
:View::JSON;
#
# Masatoshi Mizuno E<lt>lusheE<64>cpan.orgE<gt>
#
# $Id: JSON.pm 189 2007-08-08 01:43:47Z lushe $
#
use strict;
use warnings;
use Carp qw/croak/;
use base qw/Egg::View/;
use JSON;
our
=head1 NAME
Egg::Release::JSON - JSON for Egg::View.
=head1 SYNOPSIS
Configuration.
VIEW => [
.....
[ JSON => {
content_type => 'text/javascript+json',
charset => 'UTF-8',
t_view('JSON')->obj({
hoge=> 'boo',
baaa=> 'wii',
});
* It leaves it to the operation of Egg now.
=head1 DESCRIPTION
It is VIEW to output JSON.
JSON is output by the 'objToJson' functi
package Egg::Plugin::JSON;
#
# Masatoshi Mizuno E<lt>lusheE<64>cpan.orgE<gt>
#
# $Id: JSON.pm 189 2007-08-08 01:43:47Z lushe $
#
use strict;
use warnings;
use FileHandle;
use JSON;
use Carp qw/croak/;
VERSION = '0.01';
=head1 NAME
Egg::Release::JSON - JSON for Egg::Plugin.
=head1 SYNOPSIS
Controller.
use Egg qw/ JSON /;
Example code.
my $json_data = {
aaaaa => 'bbbbb',
ccccc => '
conversion of JSON data.
#
my $json_js = $e->obj2json($json_data);
my $json_hash = $e->json2obj($json_js);
#
# The JSON module object is acquired.
#
my $json= $e->json;
=head1 DESC
::JSON;
#
# Masatoshi Mizuno E<lt>lusheE<64>cpan.orgE<gt>
#
# $Id: JSON.pm 210 2007-11-03 14:38:29Z lushe $
#
use strict;
use warnings;
our $VERSION = '0.02';
=head1 NAME
Egg::Release::JSON - JSON
RIPTION
VIEW and PLUGIN to use JSON are enclosed.
=head1 EXAMPLE
=head2 VIEW
Defolt VIEW is set and the output preparation of JSON is done.
$e->default_view('JSON')->obj({
hogehoge => 'hooo
::JSON> in detail.
=head2 PLUGIN
The method for the mutual conversion of JSON is added.
my $json_data = {
aaaaa => 'bbbbb',
ccccc => 'ddddd',
};
my $json_js = $e->obj2json($json_d
package Froody::Renderer::json;
use strict;
use warnings;
use JSON::XS qw( to_json );
use Froody::Response;
use Froody::Response::Terse;
use Encode;
# If we don't know how to do it ourselves, conve
der_json = sub {
my $self = shift;
return $self->as_terse->render_json;
};
# Terse format just gets the main data structure out
# and renders it with JSON
*Froody::Response::Terse::render_json =
sub {
my $self = shift;
my $callback = $self->callback;
my $bytes = to_json( { stat => $self->status, data => $self->content } );
return $callback ? "$callback( $bytes )" : $bytes;
};
1;
package MozRepl::Plugin::JSON;
use strict;
use warnings;
use base qw(MozRepl::Plugin::Base);
use Carp::Clan qw(croak);
=head1 NAME
MozRepl::Plugin::JSON - To JSON string plugin.
=head1 VERSION
up({ plugins => { plugins => [qw/JSON/] } });
print $repl->json({ source => MozRepl::Util->javascript_value({foo => 1, bar => 2}) });
=head1 DESCRIPTION
Add json() method to L<MozRepl>.
=head1
METHODS
=head2 setup($ctx, $args)
Load script at http://www.thomasfrank.se/downloadableJS/jsonStringify.js
=cut
sub setup {
my ($self, $ctx, $args) = @_;
$ctx->execute($self->process('set
package POE::Filter::JSON;
use Carp;
use JSON::Any;
use strict;
use warnings;
use base qw( POE::Filter );
our $VERSION = '0.04';
sub BUFFER () { 0 }
sub OBJ () { 1 }
sub PARAMS () { 2 }
sub n
my %opts = @_;
my %anyopts = ( $opts{json_any} ) ? %{$opts{json_any}} : ();
bless( [
[], # BUFFER
JSON::Any->new( %anyopts ), # OBJ
\%opts,
foreach my $json (@$lines) {
if ( my $obj = eval { $self->[ OBJ ]->jsonToObj( $json ) } ) {
push( @$ret, $obj );
} else {
warn "Couldn't convert json to an obje
package Xmldoom::ORB::Definition::JSON;
use Xmldoom::ORB::Definition;
use JSON qw/ objToJson /;
use strict;
sub generate
{
my $database = shift;
my $data = [ ];
#foreach my $object ( @{$databa
e(),
%{Xmldoom::ORB::Definition::generate_object_hash($object)}
};
#$data->{$object->get_name()} = Xmldoom::ORB::Definition::generate_object_hash($object);
}
return objToJson($data);
}
1;
::JSON;
use JSON qw/ objToJson /;
use strict;
sub new
{
bless {}, shift;
}
sub get_mime_type
{
return "text/plain";
}
sub write_object
{
my ($self, $object) = (shift, shift);
print objToJson(
package PX::API::Response::JSON;
use warnings;
use strict;
use Carp;
use version; our $VERSION = qv('0.0.3');
use JSON;
sub new {
my $class = shift;
my $args = shift;
$class = ref($class) || $
->{'xs'} = JSON->new();
return $self;
}
sub parse {
my $self = shift;
my $json = shift;
my $xs = $self->{'xs'};
my $ref = $xs->jsonToObj($json);
return $ref;
}
sub format { 'json' }
1;
__
e::JSON - A C<PX::API::Response> plugin.
=head1 DESCRIPTION
This plugin is loaded automagically by C<PX::API::Response> when
the 'json' response format is returned from the Peekshows API.
L<JSON> i