json} && $conf->{json} == 1 ){
my $dest_json = $app->home->rel_file("public/${dest_lang}.json");
# Output json
$self->render_to_file('json', $dest_json
onf->{json} && $conf->{json} == 1 ){
my $dest_json = $app->home->rel_file("public/${src_lang}.json");
# Output json
$self->render_to_file('json', $dest_json, $app
onf->{json} && $conf->{json} == 1 ){
my $dest_json = $app->home->rel_file("public/${dest_lang}.json");
# Output json
$self->render_to_file('json', $de
vars{body}{result} = 'marked';
$tvars{body}{data} = join(',',@data);
$tvars{realm} = 'json';
LogDebug("body=".Dumper($tvars{body}));
}
sub Unmark {
return unless RealmCheck('p
rs{body}{result} = 'unmarked';
$tvars{body}{data} = join(',',@data);
$tvars{realm} = 'json';
# LogDebug("body=".Dumper($tvars{body}));
}
sub Marked {
return unless RealmCheck('pa
use strict;
use warnings;
use Data::Dumper;
use LWP::UserAgent qw();
use HTTP::Request qw();
use JSON qw();
use Class::Load qw();
use Carp qw( carp croak );
use Data::Validate::Type qw();
our $API_
;
my $json_in = JSON::encode_json( $args{'data'} );
carp "Sending JSON request >" . ( defined( $json_in ) ? $json_in : '' ) . "<"
if $verbose;
$request->content_type('application/json');
$req
uest->content( $json_in );
carp "Request object: ", Dumper( $request )
if $verbose;
my $user_agent = LWP::UserAgent->new();
my $response = $user_agent->request($request);
if (! $response->is_
make exceptions for circular genomes here.
# see Re: [Gmod-ajax] flatfile-to-json.pl error with GFF
# 2010-07-26
}
else {
vars{body}{result} = 'marked';
$tvars{body}{data} = join(',',@data);
$tvars{realm} = 'json';
}
sub Unmark {
return unless RealmCheck('tester','admin');
$tvars{body}{success} =
rs{body}{result} = 'unmarked';
$tvars{body}{data} = join(',',@data);
$tvars{realm} = 'json';
# LogDebug("body=".Dumper($tvars{body}));
}
sub Delete {
return unless RealmCheck('t
ars{body}{result} = 'deleted';
$tvars{body}{data} = join(',',@data);
$tvars{realm} = 'json';
}
sub Dist {
return unless RealmCheck('tester','admin');
SetTester();
$cgiparam
ings;
use JSON::XS;
use File::Temp qw(tempfile);
use Compress::Zlib;
use MIME::Base64;
use URI::Escape;
use Test::More tests => 5;
BEGIN { use_ok( 'JSON::Builder' ) }
my $json = JSON::XS->new()
INK => 1);
my $builder = JSON::Builder->new(
json => $json,
fh => $fh,
read_in => 1000*57
);
build($fh, $builder);
my $r = read_fh($fh);
is_deeply($json->decode($r), $j, "Simple"
file(UNLINK => 1);
my ($fh_plain) = tempfile(UNLINK => 1);
my $builder = JSON::Builder::Compress->new(
json => $json,
fh => $fh,
read_in => 1000*57,
fh_plain => $fh_plain,
);
ons of modules in CPAN for data access and traversal.
=over
=item *
L<Data::Diver>
=item *
L<JSON::Pointer>
=item *
L<Data::Path>
=item *
L<Data::SPath>
=item *
L<Data::DPath>
=item *
L<D
)
{
# You must use references to integers in order to have JSON.pm properly
# encode these as JSON boolean values. Without this, JSON will encode integer
# value as string...which is how I foun
tp://stackoverflow.com/questions/1087308/why-cant-i-properly-encode-a-boolean-from-postgresql-via-jsonxs-via-perl
$data->{'silenced'} = ( $args{'silenced'} == 0 ? \0: \1 );
}
my $response = $sel
)
{
# You must use references to integers in order to have JSON.pm properly
# encode these as JSON boolean values. Without this, JSON will encode integer
# value as string...which is how I foun
azon::DynamoDB::Simple;
use Amazon::DynamoDB;
use Carp qw/cluck confess carp croak/;
use DDP;
use JSON::XS;
use Moo;
use Try::Tiny;
our $VERSION="0.01";
=head1 NAME
Amazon::DynamoDB::Simple - Simpl
oDB can't handle complex data structures. But this module
can because it serializes yer stuff to JSON if needed.
At the moment you cannot use this module against a single dynamodb server. The
table
eys %item) {
my $value = $item{$key};
$new{$key} = $self->is_valid_json($value)
? JSON::XS->new->utf8->pretty->decode($value)
: $value;
}
return %new
package Webqq::Qun;
use strict;
use JSON;
use Storable qw(dclone);
use Scalar::Util qw(blessed reftype);
use base qw(Webqq::Qun::Authorize Webqq::Qun::Operate Webqq::Qun::Base);
use HTTP::Cookies;
use
owing reasons:
=over
=item *
I wanted to store my fixture tables in whatever format i wanted (JSON, YAML, Storable, etc)
=item *
I wanted to simplify the execution process to make it very transp
VERSION = '0.12';
use base qw(App::Cmd::Simple);
use Carp;
use Time::Piece;
use File::Temp;
use JSON;
use LWP::UserAgent;
use URI;
my $duration = 2 * 24 * 60 * 60;
sub opt_spec {
return (
ri);
if ($res->is_error) {
croak "HTTP error: ", $res->status_line;
}
JSON::decode_json($res->content);
}
1;
__END__
=encoding utf-8
=for stopwords
=head1 NAME
App::CPAN::Fr
package Webqq::Qun::Operate;
use strict;
use JSON;
use Encode;
use Webqq::Util qw(gen_url gen_url2);
my %levelname;
sub get_token{
my $self = shift;
my $t = $self->search_cookie("skey");
m
m/^jQuery18302889768735039979_1427194882987\((.*?)\);/;
my $json = JSON->new->utf8->decode($data);
return if $json->{retcode}!=0;
}
return;
}
sub get_qun {
my $self
my $json = JSON->new->utf8->decode($res->content);
return if $json->{ec}!=0;
$self->{data} = [];
for my $t (qw(join manage create)){
for(@{$json->{$t}}){
er' at C<irc.perl.org>.
=head1 SEE ALSO
=over 4
=item *
L<Test::Deep>
=item *
L<Test::Deep::JSON>
=back
=head1 AUTHOR
Karen Etheridge <ether@cpan.org>
=head1 COPYRIGHT AND LICENSE
This soft
}
my $json_routes = $c->render_to_string( json => \%names2paths );
utf8::decode( $json_routes );
my $js = <<"JS";
var mojolicious_routes = $json_routes;
function
# In your layout template
<head>
<%= js_url_for%>
</head>
# In your javascript
$.getJSON( url_for( 'messages_show', {message_id: 123} ), params, function() { ... } )
# Instead of hel
package Couchbase::Bucket;
use strict;
use warnings;
use JSON::MaybeXS;
use URI;
use Storable;
use Couchbase::Core;
use Couchbase::_GlueConstants;
use Couchbase::Document;
use Couchbase::Settings;
TPDocument;
use Couchbase::N1QL::Handle;
my $_JSON = JSON::MaybeXS->new()->allow_nonref;
sub _js_encode { $_JSON->encode($_[0]) }
sub _js_decode { $_JSON->decode($_[0]) }
sub new {
my ($pkg, $co
);
$self->connect() unless $noconn;
$self->_encoder(CONVERTERS_JSON, \&_js_encode);
$self->_decoder(CONVERTERS_JSON, \&_js_decode);
$self->_encoder(CONVERTERS_STORABLE, \&Storable::fr
nyEvent::Handle;
use Protocol::WebSocket::Handshake::Client;
use Protocol::WebSocket::Frame;
use JSON;
use URI;
use Data::Dumper;
use constant CHANNELS => qw(
order_book
live_trades
);
use
to move and rewrite into your own module.
# within these subroutines you will have access to the json response in a hash format.
sub trade {
my $self = shift;
my $data = shift;
warn Data:
while (my $msg = $self->frame->next) {
my $d;
eval { $d = $self->json->decode($msg); } or do {
my $e = $@;
warn $self->now . ' - error:
ackage Data::Transit::Writer::JSONVerbose;
use strict;
use warnings;
no warnings 'uninitialized';
our $VERSION = '0.8.04';
use parent 'Data::Transit::Writer';
use JSON;
sub new {
my ($self, $outp
eturn $self->SUPER::new($output, %args);
}
sub _encode {
my ($self, $data) = @_;
return encode_json($data);
}
sub _wrap_top_level_scalar {
my ($self, $converted_data) = @_;
return {"~#'" => $con
obox
=head3 L<autodie> 2.22
=head3 L<autobox::Core>
=head3 L<autobox::dump>
=head3 L<autobox::JSON>
=head3 L<autobox::Colors>
=head2 Other Libraries I Use
=head3 L<aliased>
=head3 L<lib::if::d
e Data::Transit::Reader::JSON;
use Data::Transit::Reader::MessagePack;
use Data::Transit::Reader::JSONVerbose;
use Data::Transit::Writer::JSON;
use Data::Transit::Writer::JSONVerbose;
use Data::Transi
use Data::Transit;
my $writer = Data::Transit::writer($fh, 'json');
$writer->write($value);
my $reader = Data::Transit::reader('json');
my $val = $reader->read($value);
For example:
use Data
it::writer($fh, 'json');
$writer->write(["abc", 12345]);
my $reader = Data::Transit::reader('json');
my $vals = $reader->read($output);
Instead of json, you may also provide json-verbose and mess