package App::JSONPretty;
use strictures 1;
use JSON ();
use Try::Tiny;
our $VERSION = 1;
my $usage = "Usage:
$0 <filename
$0 filename
";
sub new_json_object {
JSON->new->utf8->pretty->relaxe
my ($json, $src_data) = @_;
try {
$json->decode($src_data)
} catch {
die "Error parsing JSON: $_\n";
}
}
sub encode_using {
my ($json, $data_structure) = @_;
try {
$json->enco
ting JSON: $_\n";
}
}
sub run {
my $json = new_json_object;
print STDOUT encode_using $json, decode_using $json, source_data;
return 0;
}
exit run unless caller;
1;
=head1 NAME
jsonpret
object to a Data::Pairs structure and
back.
The resulting structure may be serialized, e.g., as JSON or YAML.
=head1 SEE ALSO
MARC::Record
Data::Pairs
=head1 AUTHOR
Brad Baxter, E<lt>bbaxter@cpa
DateTime helpers.
=head1 DESCRIPTION
Support DateTime objects "natively" by making sure they TO_JSON-ify
properly, and provide some useful helper methods.
=cut
package App::Pebble::Helpers::DateTi
ings;
use DateTime;
use Carp;
=head2 METHODS
=cut
# Needed by Pebble::Object and JSON::XS
sub DateTime::TO_JSON {
my $self = shift;
"$self";
}
=head2 DateTime::round( $to_unit = "day" ) :
arse matching lines into objects with named attributes.
# The default output format is one-line JSON.
cat lib/App/Pebble.pm | \
p 'P->match( regex => qr/^=head(\d+)\s+(.+)/, has => ["level", "te
kend(
$dsn,
serializer => KiokuDB::Serializer::Crypt->new(
serializer => 'json',
crypt_cipher => 'Rijndael',
crypt_mode => 'CFB',
crypt_key =
traits => 'CatalystX::Controller::ExtJS::REST::SimpleExcel::Trait';
use strict;
use warnings;
use JSON::XS ();
after list => sub {
my ($self, $c) = @_;
return unless($c->request->accepts('app
$rcopy = $rcopy->{$1};
}
push(@row, ref $rcopy->{$hcopy} ? JSON::XS::encode_json($rcopy->{$hcopy}) : $rcopy->{$hcopy} );
}
push(@rows, \@row);
}
var data = JSON.parse(e.data);
if (data.msg)
alert (data.msg);
};
function send_msg(message) {
socket.send(JSON.stringify({ msg: mess
VERSION = '0.02';
use Carp;
use Data::Dumper;
use LWP::UserAgent;
use HTTP::Request::Common;
use JSON;
use vars qw(@AUTO_ATTRIBUTES @CLASS_ATTRIBUTES %DEFAULTS @EXPORT_OK);
use Class::AutoClass qw(
=@_;
my %args=(request_type=>'idtypes',
output_format=>'json');
my $content=$self->_fetch(%args);
my $table=decode_json($content);
wantarray? @$table:$table;
}
# reques
translate {
my ($self,%argHash)=@_;
my %args=(request_type=>'translate', output_format=>'json');
delete @argHash{keys %args}; # override values
@args{keys %argHash}=values %argHash if
lf->response->content_type =~ m/json/ ) {
$value =~ s/^var tumblr_api_read = //;
$value =~ s/;$//;
$value = WebService::Tumblr::json->decode( $value );
}
e LWP::UserAgent;
use HTTP::Request::Common();
use URI::PathAbstract;
use JSON;
our $json = JSON->new->pretty;
sub json { $json }
use WebService::Tumblr::Dispatch;
use WebService::Tumblr::Result;
us
('colours' => \@colours) : ())
);
}
=head2 TO_JSON()
Returns HashRef that is possible to give to C<encode_json()> function.
=cut
sub TO_JSON {
my ($self) = @_;
my @values_with_la
too
=head1 METHODS
=head2 TO_JSON()
Returns HashRef that is possible to give to C<encode_json()> function.
=cut
sub TO_JSON {
my ($self) = @_;
my %json = (
map { my $v = $se
{ $_->name } $self->meta->get_all_attributes
);
$json{'3d'} = delete $json{'is3d'}
if (exists $json{'is3d'});
return \%json;
}
=head2 color()
Same as colour().
=cut
sub color
li><a href="http://cpansearch.perl.org/src/JKUTEJ/Chart-OFC2-0.08_01/examples/for-pod/bar-data.json">json source</a></li>
</ul>
=end html
=cut
use Moose;
use MooseX::StrictConstructor;
our $VERSIO
THODS
=head2 new()
Object constructor.
=head2 TO_JSON()
Returns HashRef that is possible to give to C<encode_json()> function.
=cut
sub TO_JSON {
my $self = shift;
return {
_JSON()
Returns ArrayRef that is possible to give to C<encode_json()> function.
NOTE: values are reversed. This is done so that the C<y_axis->labels> match to
the values properly.
=cut
sub TO_JSON
li><a href="http://cpansearch.perl.org/src/JKUTEJ/Chart-OFC2-0.08_02/examples/for-pod/pie-data.json">json source</a></li>
</ul>
=end html
=cut
use Moose;
use MooseX::StrictConstructor;
our $VERSIO
s 'values' => (is => 'rw', isa => 'Chart::OFC2::PieValues', 'coerce' => 1,);
override 'TO_JSON' => sub {
my $self = shift;
my $pie_element = super();
# get the colours fr
se AC::MrGamoo::Debug;
use AC::Daemon;
use AC::Conf;
use AC::Misc;
use AC::MrGamoo::Protocol;
use JSON;
use Sys::Hostname;
use Socket;
require 'AC/protobuf/mrgamoo.pl';
require 'AC/protobuf/mrgamoo_s
ant_reply => 1,
},{
jobid => $me->{id},
options => to_json( $r->{config} ),
initres => to_json( $initres, {allow_nonref => 1} ),
jobsrc => $mr->src(),
c
Door;
use warnings;
use strict;
use Carp;
use Data::Dumper;
use Digest::SHA qw(sha256_hex);
use JSON;
use REST::Client;
use UUID::Tiny;
#use Smart::Comments -ENV;
use base qw(Class::Accessor);
us
oded_response_body =
$response_body && $response_body ne q{}
? decode_json( $response_body )
: undef; # TODO test for response_body eq q{}
#
> 'json'}, $currency_data );
my $currency_id = $currency->[0]->{'id'};
$currency_data->{'pub_title'} = 'Coins';
$client->PUT( sprintf( 'currency/%s', $currency_id ), {format => 'json'},
$self->get_id, $resource->get_resource_name,
$resource->get_id ),
{format => 'json'}
);
return $result;
}
1;
__END__
=head1 NAME
WWW::BigDoor::URL - URL Resource Object
C::MrGamoo::MySelf;
use AC::MrGamoo::Config;
use AC::DC::Sched;
use AC::Misc;
use AC::Import;
use JSON;
use strict;
our @EXPORT = qw(pick_best_addr_for_peer peer_list_all get_peer_by_id);
my $KEEPDO
rn $txt;
}
sub report_json {
my $all = peer_list_all();
my @fields = qw(hostname environment subsystem datacenter server_id status sort_metric);
return encode_json( [ map {
my %