###############
## $Id: Json.pm 6000 2006-05-02 13:43:59Z spadkins $
#############################################################################
package App::Serializer::Json;
$VERSION = (q$Revisio
p;
use App::Serializer;
@ISA = ( "App::Serializer" );
use strict;
=head1 NAME
App::Serializer::Json - Interface for serialization and deserialization
=head1 SYNOPSIS
use App;
$context =
{
arbitrary => 'depth',
},
};
$json = $serializer->serialize($data);
$data = $serializer->deserialize($json);
print $serializer->dump($data), "\n";
=head1 DESCRIP
package Resource::Pack::JSON::URL;
BEGIN {
$Resource::Pack::JSON::URL::VERSION = '0.01';
}
use Moose;
extends 'Resource::Pack::URL';
=head1 NAME
Resource::Pack::JSON::URL - subclass of Resource::
Pack::URL to clean up the json2.js souce
=head1 VERSION
version 0.01
=head1 DESCRIPTION
This modifies the install process to strip out the alert that json2.js includes
at the top of the file.
=cu
my $contents = $installed->slurp;
$contents =~ s/^\Qalert('IMPORTANT: Remove this line from json2.js before deployment.');\E\n//;
my $fh = $installed->openw;
$fh->print($contents);
$
ck::JSON;
BEGIN {
$Resource::Pack::JSON::VERSION = '0.01';
}
use Moose;
use Resource::Pack;
use Resource::Pack::JSON::URL;
extends 'Resource::Pack::Resource';
=head1 NAME
Resource::Pack::JSON -
Resource::Pack resource for the JSON Javascript library
=head1 VERSION
version 0.01
=head1 SYNOPSIS
my $resource = Resource::Pack::JSON->new(install_to => '/var/www/js');
$resource->installl;
DESCRIPTION
This provides the JSON library as a L<Resource::Pack> resource.
=cut
=head1 ATTRIBUTES
=cut
=head2 use_bundled
If true, uses the bundled copy of json2.js that is shipped with this d
matter::JSON;
use Any::Moose;
with 'Net::OpenSocial::Client::Formatter';
use JSON ();
has '+name' => (
default => q{json},
);
has '+content_type' => (
default => q{application/json},
);
s
self, $obj ) = @_;
my $content = JSON::encode_json($obj);
return $content;
}
sub decode {
my ( $self, $content ) = @_;
my $obj = JSON::decode_json($content);
return $obj;
}
no An
=head1 NAME
Net::OpenSocial::Client::Formatter::JSON - JSON formatter
=head1 SYNOPSIS
my $formatter = Net::OpenSocial::Client::Formatter::JSON->new;
my $request_content = $formatter->encod
Syntax::Highlight::JSON - Convert JSON to a pretty-printed and syntax-highlighted HTML representation
=cut
package Syntax::Highlight::JSON;
use strict;
use warnings;
use JSON::Streaming::Reader;
_;
my $out_string = "";
my $out_stream = IO::Scalar->new(\$out_string);
my $reader = JSON::Streaming::Reader->for_stream($in_stream);
_highlight($reader, $out_stream);
return $o
_;
my $out_string = "";
my $out_stream = IO::Scalar->new(\$out_string);
my $reader = JSON::Streaming::Reader->for_string($in_string);
_highlight($reader, $out_stream);
return $o
ite::Serializer::JSON;
use strict;
use base qw( RPC::Lite::Serializer );
use RPC::Lite::Request;
use RPC::Lite::Response;
use RPC::Lite::Notification;
use RPC::Lite::Error;
use JSON;
use Data::Dum
we support this serializer version
return 1;
}
sub GetVersion
{
my $self = shift;
return $JSON::VERSION;
}
sub Serialize
{
my $self = shift;
my $object = shift;
my $type = ref($objec
id => $object->{id},
};
}
else # try our best
{
# JSON should unbless this for us...
}
my $data = to_json( $object, { convert_blessed => 1 } );
$self->_Debug('Serializing',
til::JSON - JSON utility functions
=head1 DESCRIPTION
This is just a wrapper around a singleton JSON object, ensuring that everywhere
we deal with JSON we do it in a consistent way.
We use JSON::An
g JSON libraries
from CPAN.
=cut
package WebService::TypePad::Util::JSON;
use strict;
use warnings;
use JSON::Any;
use Exporter 'import';
our @EXPORT = qw(json_encode json_decode json_true json_f
$json = JSON::Any->new();
=pod
=head2 json_encode($ref)
Given some JSON-able reference (usually a HASH ref), return a JSON string.
=cut
sub json_encode {
my ($value) = @_;
return $json->
package Waft::JSON;
use 5.005;
use strict;
use vars qw( $VERSION );
BEGIN { eval { require warnings } ? 'warnings'->import : ( $^W = 1 ) }
use Waft 0.9907 ();
$VERSION = '0.03';
$VERSION = eval $V
\s* json \s* = (.*?)
%>}{<% \$Waft::Self->output( \$Waft::Self->convert_json($1) ); %>}gxms;
return $self->next(\$template, $template_file, $template_class);
}
sub convert_json { $
_[0]->_make_json(@_[1 .. $#_]) }
sub _make_json {
my ($self, @values) = @_;
VALUE:
for my $value (@values) {
if ( not defined $value ) {
$self->warn('Use of uninitial
View::JSON;
use strict;
our $VERSION = '1.001000';
use base 'Catalyst::View::JSON';
1;
__END__
=pod
=head1 NAME
Foorum::View::JSON - JSON for Foorum
=head1 SEE ALSO
L<Catalyst::View::JSON>
=he
Hoppy::Formatter::JSON;
use strict;
use warnings;
use base qw( Hoppy::Base );
use Encode;
use JSON;
sub serialize {
my ( $self, $data, $code ) = @_;
my $json = JSON::to_json($data);
if (
utf8::decode($json);
}
return $json;
}
sub deserialize {
my ( $self, $json, $code ) = @_;
$json = decode( "utf8", $json );
my $data = JSON::from_json($json);
return $data
ormatter::JSON - IO formatter that can translate from or to JSON.
=head1 SYNOPSIS
use Hoppy::Formatter::JSON;
my $formatter = Hoppy::Formatter::JSON->new;
# from perl data to JSON
my $dat
kage Test::JSON;
use strict;
use Carp;
use Test::Differences;
use JSON::Any;
use base 'Test::Builder::Module';
our @EXPORT = qw/is_json is_valid_json/;
=head1 NAME
Test::JSON - Test JSON data
=he
SION = '0.11';
my $JSON = JSON::Any->new;
=head1 SYNOPSIS
use Test::JSON;
is_valid_json $json, '... json is well formed';
is_json $json, $expected_json, '... and it matche
id_json
=item * is_json
=back
=head1 DESCRIPTION
JavaScript Object Notation (JSON) is a lightweight data interchange format.
L<Test::JSON> makes it easy to verify that you have built valid JSON an
serializer->serialize_object_to_stream($object, $fh);
=cut
package Util::DataThing::Serializer::JSON;
use strict;
use warnings;
use Carp;
sub serialize_object_to_string {
Carp::croak("$_[0] do
#!/usr/bin/perl
package POE::Filter::JSON::Incr;
use Any::Moose;
use JSON;
use POE::Filter::JSON::Incr::Error;
use namespace::clean -except => [qw(meta)];
our $VERSION = "0.03";
extends our @ISA,
buffer => [],
json => $self->_build_json,
);
}
has buffer => (
#traits => [qw(NoClone)],
isa => "ArrayRef",
is => "rw",
lazy_build => 1,
);
sub _build_buffer { [] }
has json => (
#traits =
);
has json_opts => (
isa => "ArrayRef",
is => "rw",
lazy_build => 1,
);
sub _build_json {
my $self = shift;
my $json = JSON->new;
foreach my $opt ( @{ $self->json_opts } ) {
$json->$opt;
package POE::Filter::JSON::Incr::Error;
use Any::Moose;
has error => (
is => "ro",
);
has chunk => (
is => "ro",
);
__PACKAGE__
__END__
=pod
=head1 NAME
POE::Filter::JSON::Incr::Error - Input
error objects
POE::Filter::JSON::Incr->new(
errors => 1,
);
# and in your event handler, check for them:
if ( blessed($_[ARG0]) and $_[ARG0]->isa("POE::Filter::JSON::Incr::Error") ) {
warn "
s JSON data
}
=head1 DESCRIPTION
This is just a simple container for errors and the chunk of text that created
the error.
=head1 ATTRIBUTES
=over 4
=item error
The value of C<$@>, what L<JSON>
package Mirror::JSON;
use 5.006;
use strict;
use Mirror::URI ();
use JSON ();
use vars qw{$VERSION @ISA};
BEGIN {
$VERSION = '0.90';
@ISA = 'Mirror::URI';
}
#######################
'mirror.json';
}
sub parse {
my $class = shift;
# Make sure we actually have a YAML document
unless ( $_[0] =~ /^{/ ) {
return undef;
}
# Parse the file
my $docs = JSON::from_json($_[0]);
Carp::croak("Illegal JSON document");
}
return $docs;
}
1;
=pod
=head1 NAME
Mirror::JSON - Mirror Configuration and Auto-Discovery
=head1 DESCRIPTION
A C<mirror.json> file is used to allow
age Parley::View::JSON;
use strict;
use warnings;
use base qw( Catalyst::View::JSON );
1;
__END__
=head1 NAME
Parley::View::JSON - Catalyst View
=head1 DESCRIPTION
Catalyst JSON View.
=head1 AUT
JSON;
use warnings;
use strict;
use JSON::Any;
use base 'Exporter';
our @EXPORT_OK = qw(
to_json
from_json
json_header
json_body
json_callback
add_json_header
clear_json
_header
json_header_string
json_header_value
);
our %EXPORT_TAGS = ( all => \@EXPORT_OK );
=head1 NAME
CGI::Application::Plugin::JSON - easy manipulation of JSON headers
=cut
our $VERSI
n::Plugin::JSON ':all';
# add_json_header() is cumulative
$self->add_json_header( foo => 'Lorem ipsum...');
$self->add_json_header( bar => [ 0, 2, 3, 4 ] );
$self->add_json_header( ba
###############################################################################
#json.pm
#Last Change: 2009-01-21
#Copyright (c) 2009 Marc-Seabstian "Maluku" Lucksch
#Version 0.1
################
s file is an addon to the Dotiac::DTL project.
#http://search.cpan.org/perldoc?Dotiac::DTL
#
#json.pm is published under the terms of the MIT license, which basically
#means "Do with it whatever
::Addon::json;
use strict;
use warnings;
require JSON;
#If it is not already loaded.
require Dotiac::DTL::Filter;
require Dotiac::DTL::Value;
our $VERSION=0.1;
our $json=JSON->new();
package App::CamelPKI::View::JSON;
use strict;
use base 'Catalyst::View::JSON';
=head1 NAME
App::CamelPKI::View::JSON - the view used to throw data to an AJAX client
or any other RPC client.
=head
1 SYNOPSIS
=head1 DESCRIPTION
This package is a (trivial for now) subclass of L<Catalyst::View>.
It allow to send a Perl data structure to an HTTP client, using
L<JSON> encoding format.
=cut
1;
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