);
if( $resp->is_success ) {
my $user = $self->_stringify_json_booleans(
JSON::MaybeXS::decode_json( $resp->decoded_content )
);
$session_data->{google}{use
C<json_decode>
see L<http://duktape.org/api.html#duk_json_decode>
=cut
*json_decode = \&aperl_duk_json_decode;
=item C<json_encode>
see L<http://duktape.org/api.html#duk_json_encode>
=cut
*json_e
ncode = \&aperl_duk_json_encode;
=item C<load_function>
see L<http://duktape.org/api.html#duk_load_function>
=cut
*load_function = \&aperl_duk_load_function;
=item C<map_string>
see L<http://dukt
ntext *ctx, duk_idx_t idx);
DUK_EXTERNAL_DECL const char *duk_json_encode(duk_context *ctx, duk_idx_t idx);
DUK_EXTERNAL_DECL void duk_json_decode(duk_context *ctx, duk_idx_t idx);
DUK_EXTERNAL_DECL v
POST => $uri,
[
'Content-Type' => 'application/json',
Accept => 'application/json',
]
);
$request->header("Authorization", join(" ", "Bas
:Request;
use JSON qw(decode_json);
use URI;
use WebService::ValidSign::Types qw(
WebServiceValidSignURI
WebServiceValidSignAuthModule
);
requires qw(action_endpoint);
has json => (
is
=> 'ro',
builder => 1,
lazy => 1,
);
sub _build_json {
require JSON::XS;
return JSON::XS->new->convert_blessed;
}
has auth => (
is => 'ro',
required => 1,
is
t = HTTP::Request->new(
GET => $uri,
[
'Content-Type' => 'application/json',
]
);
$self->call_api_download(
$request,
sub {
my
return $orig->($class,
map { lower_snake_case($_) => $args{$_} } keys %args);
};
sub TO_JSON {
my $self = shift;
my $meta = $self->meta;
my %result;
for my $attr ($meta->get_
"_url" : "XX_RT_URL_XX/REST/2.0/queue/1"
}
]
}
This format is JSON, which is a format for which many programming languages
provide libraries for parsing and generat
TP verb (C<POST> instead of C<GET>), a C<Content-Type>
header (to tell REST2 that your content is JSON instead of, say, XML),
and the fields for your new ticket such as Subject. Here is the curl
invoc
apped to multiple lines for readability.
curl -X POST
-H "Content-Type: application/json"
-d '{ "Subject": "hello world" }'
-H 'Authorization: token XX_TOKEN_XX'
ount> object. Build for you.
=back
=head1 BUGS
L<JSON::XS> 4.01 has a bug that causes JSON serialization errors. Please
upgrade or downgrade JSON::XS where needed.
=head1 ACKNOWLEDGEMENTS
This mo
ead1 App::JYJ
Convert JSON to YAML to JSON to...
=head2 Synopsis
$ cat file.json | jyj # YAML
$ cat file.json | jyj | jyj # JSON
$ cat file.json | jyj | jyj |jyj # YA
ol called C<jyj>.
It reads stdin.
If it looks like JSON, it prints the YAML dump of the JSON decoding.
If it looks like YAML, it prints the JSON encoding of the YAML load.
That's it.
=head2 Autho
);
if( $resp->is_success ) {
my $user = $self->_stringify_json_booleans(
JSON::MaybeXS::decode_json( $resp->decoded_content )
);
$session_data->{salesforce}
);
if( $resp->is_success ) {
my $user = $self->_stringify_json_booleans(
JSON::MaybeXS::decode_json( $resp->content )
);
$session_data->{facebook}{user_info
nings;
our $VERSION = '0.0.2';
use JSON::PP;
use YAML::PP;
use IO::All;
use Mo;
sub run {
my $input = io('-')->utf8->all;
my $output;
my $json = JSON::PP->new->pretty->indent_length(2);
[]/) {
my $data = $json->decode($input);
$output = $yaml->dump($data);
}
else {
my $data = $yaml->load_string($input);
$output = $json->encode($data);
}
t: '...'
# application_key: '...'
# method: 'users.getCurrentUser'
# format: 'json'
# fields: 'email,name,gender,birthday,location,uid,pic_full'
#
# to your providers configu
);
if( $resp->is_success ) {
my $user = $self->_stringify_json_booleans(
JSON::MaybeXS::decode_json( $resp->content )
);
$session_data->{odnoklassniki}{user
s => 'rw',
isa => Str,
required => 1,
);
has path => (is => 'ro');
around TO_JSON => sub {
my $orig = shift;
my $self = shift;
my $rv = $orig->($self, @_);
delete
E::Base64;
extends 'RT::Extension::REST2::Resource';
use RT::Extension::REST2::Util qw( error_as_json update_custom_fields update_role_members fix_custom_role_ids);
sub dispatch_rules {
Path::Di
{ [ { 'application/json' => sub {} } ] }
sub content_types_accepted { [ { 'text/plain' => 'add_message' }, { 'text/html' => 'add_message' }, { 'application/json' => 'from_json' }, { 'multipart/fo
my $json_str = $self->request->parameters->{JSON};
return error_as_json(
$self->response,
\400, "JSON is a required field for multipart/form-data")
unless $json_str;
ing UTF-8
=head1 NAME
JSON::Parse - Parse JSON
=head1 SYNOPSIS
use JSON::Parse 'parse_json';
my $json = '["golden", "fleece"]';
my $perl = parse_json ($json);
# Same effect as
onvert JSON into Perl.
=head1 VERSION
This documents version 0.62 of JSON::Parse corresponding to
L<git commit d04630086f6c92fea720cba4568faa0cbbdde5a6|https://github.com/benkasminbullock/JSON-Parse
le for parsing JSON. (JSON means "JavaScript Object Notation"
and it is specified in L</RFC 8259>.)
JSON::Parse offers the function L</parse_json>, which takes a string
containing JSON, and returns a
urrent_user';
requires 'base_uri';
with 'RT::Extension::REST2::Resource::Record::WithETag';
use JSON ();
use RT::Extension::REST2::Util qw( serialize_record );
use Scalar::Util qw( blessed );
sub s
{ 'utf-8' }
sub content_types_provided { [
{ 'application/json' => 'to_json' },
] }
sub to_json {
my $self = shift;
return JSON::to_json($self->serialize, { pretty => 1 });
}
1;
;
use warnings;
use Moose;
use namespace::autoclean;
use RT::Extension::REST2::Util qw( error_as_json );
extends 'RT::Extension::REST2::Resource::Record';
with 'RT::Extension::REST2::Resource::Recor
unless ($self->record->CustomFieldObj->Type =~ /^(?:Image|Binary)$/) {
return error_as_json(
$self->response,
\400, "Only Image and Binary CustomFields can be downlo
s_code );
requires 'to_json';
sub process_post {
my $self = shift;
my $json = $self->to_json;
unless (is_status_code($json)) {
$self->response->body( $json );
return 1;
} else {
return $json;
}
}
1;
ce::Role::RequestBodyIsJSON;
use strict;
use warnings;
use MooseX::Role::Parameterized;
use namespace::autoclean;
use JSON ();
use RT::Extension::REST2::Util qw( error_as_json );
use Moose::Util::Ty
header('Content-Type') =~ /^application\/json/;
my $json = eval {
JSON::from_json($request->content)
};
if ($@ or not $json) {
my $error = $@;
rror_as_json($self->response, undef, "JSON parse error: $error");
return 1;
}
elsif (ref $json ne $P->type) {
error_as_json($self->response, undef, "JSON object