:Resource::Collection::ProcessPOSTasGET',
'RT::Extension::REST2::Resource::Collection::QueryByJSON';
sub dispatch_rules {
Path::Dispatcher::Rule::Regex->new(
regex => qr{^/searches/?$
tributes' } },
)
}
use Encode qw( decode_utf8 );
use RT::Extension::REST2::Util qw( error_as_json );
use RT::Search::Simple;
sub allowed_methods {
[ 'GET', 'HEAD', 'POST' ]
}
sub limit_coll
ST2::Resource::Role::RequestBodyIsJSON' =>
{ type => 'ARRAY' };
use RT::Extension::REST2::Util qw(expand_uid);
use RT::Extension::REST2::Resource::Ticket;
use JSON ();
sub dispatch_rules {
Pat
{ 'application/json' => sub {} } ] }
sub content_types_accepted { [ { 'application/json' => 'from_json' } ] }
sub from_json {
my $self = shift;
my $params = JSON::decode_json( $self->reques
my @errors;
# Ported from RT::Extension::REST2::Resource::Message::from_json
if ( $param->{Attachments} ) {
foreach my $attachment
ackage RT::Extension::REST2::Resource::Collection::QueryByJSON;
use strict;
use warnings;
use Moose::Role;
use namespace::autoclean;
use JSON ();
with (
'RT::Extension::REST2::Resource::Collect
ion::ProcessPOSTasGET',
'RT::Extension::REST2::Resource::Role::RequestBodyIsJSON'
=> { type => 'ARRAY' },
);
requires 'collection';
has 'query' => (
is => 'ro',
isa
f->request->param('query')
: $self->request->content;
return $content ? JSON::decode_json($content) : [];
}
sub allowed_methods {
[ 'GET', 'POST' ]
}
sub searchable_fields {
::autoclean;
use RT::Extension::REST2::Util qw(expand_uid expand_uri custom_fields_for);
use JSON qw(to_json);
sub hypermedia_links {
my $self = shift;
return [ $self->_self_link, $self->_rtl
eware::ErrorAsJSON;
use strict;
use warnings;
use base 'Plack::Middleware';
use Plack::Util;
use HTTP::Status qw(is_error status_message);
use RT::Extension::REST2::Util 'error_as_json';
sub call
ader_get($headers, 'content-type');
my $is_json = $content_type && $content_type =~ m/json/i;
if ( is_error($status_code) && !$is_json ) {
my $plack_res = Plack::Response->
/json' => 'to_json' },
] }
sub to_json {
my $self = shift;
my $status = $self->search;
return $status if is_status_code($status);
return \400 unless $status;
return JSON::to_json(
use warnings;
use Moose::Role;
use namespace::autoclean;
use JSON ();
use RT::Extension::REST2::Util qw( deserialize_record error_as_json expand_uid update_custom_fields update_role_members fix_custo
role_ids );
use List::MoreUtils 'uniq';
with 'RT::Extension::REST2::Resource::Role::RequestBodyIsJSON'
=> { type => 'HASH' };
requires 'record';
requires 'record_class';
sub post_is_create
n/json' => 'from_json'}, { 'multipart/form-data' => 'from_multipart' } ] }
sub from_multipart {
my $self = shift;
my $json_str = $self->request->parameters->{JSON};
return error_as_json(
{ ['GET'] }
sub content_types_provided { [{ 'application/json' => 'to_json' }] }
sub to_json {
my $self = shift;
return JSON::to_json({
Version => $RT::VERSION,
Plugins => [
esenting the "null" in JSON. Although we're now
using PL_sv_yes and PL_sv_no, we don't use PL_sv_undef, because
perldoc perlguts says it's a bad idea. */
static SV * json_null;
/* Code starts
icode.c"
#include "json-common.c"
#define PERLING
#include "json-perl.c"
#undef PERLING
#define TOKENING
#include "json-perl.c"
#undef TOKENING
#include "json-perl.c"
#include "json-entry-points.c"
#i
de "json-random-test.c"
#endif /* def TESTRANDOM */
#include "json-whitespace.c"
#ifdef NOPERL
#error "Cannot define NOPERL error when compiling Perl version"
#endif /* def NOPERL */
typedef json_par
:Tickets' } },
)
}
use Encode qw( decode_utf8 );
use RT::Extension::REST2::Util qw( error_as_json expand_uid );
use RT::Search::Simple;
has 'query' => (
is => 'ro',
isa
elf = shift;
my ($ok, $msg) = $self->collection->FromSQL( $self->query );
return error_as_json( $self->response, 0, $msg ) unless $ok;
super();
return 1;
};
sub expand_field {
my
Extension::REST2::Resource::Collection';
with 'RT::Extension::REST2::Resource::Role::RequestBodyIsJSON' =>
{type => 'ARRAY'};
has 'user' => (
is => 'ro',
isa => 'RT::User',
);
sub dispatc
, 'HEAD', 'DELETE', 'PUT');
return \@ok;
}
sub content_types_accepted {[{'application/json' => 'from_json'}]}
sub delete_resource {
my $self = shift;
my $collection = $self->collection;
oup->DeleteMember($self->user->id);
}
return 1;
}
sub from_json {
my $self = shift;
my $params = JSON::decode_json($self->request->content);
my $user = $self->user;
my $met
=head1 NAME
JSON::Tokenize - Tokenize JSON
=head1 SYNOPSIS
use JSON::Tokenize ':all';
my $input = '{"tuttie":["fruity", true, 100]}';
my $token = tokenize_json ($input);
SION
This documents version 0.62 of JSON::Tokenize corresponding to
L<git commit d04630086f6c92fea720cba4568faa0cbbdde5a6|https://github.com/benkasminbullock/JSON-Parse/commit/d04630086f6c92fea720cba
dule for tokenizing a JSON string. "Tokenizing" means
breaking the string into individual tokens, without creating any Perl
structures. It uses the same underlying code as
L<JSON::Parse>. Tokenizing c
);
if( $resp->is_success ) {
my $user = $self->_stringify_json_booleans(
JSON::MaybeXS::decode_json( $resp->content )
);
$session_data->{github}{user_info}
// undef or JSON::null()
return jv_null();
}
else if (SvROK(p_sv) && SvTYPE(SvRV(p_sv)) == SVt_IV) {
// boolean: \0 or \1, equilvalent of $JSON::PP::true, $JSON::PP::false
sv)));
}
else if (SvROK(p_sv) && sv_derived_from(p_sv, "JSON::PP::Boolean")) {
// boolean: $JSON::PP::true and $JSON::PP::false
return jv_bool((bool)SvTRUE(SvRV(p_sv)));
jval;
}
else {
// not supported
croak("cannot convert perl object to json format: SvTYPE == %i", SvTYPE(p_sv));
}
// NOREACH
}
void * my_jv_output(pTHX_ jv j
=encoding UTF-8
=head1 NAME
JSON::Whitespace - Alter the insignificant whitespace of JSON
=head1 SYNOPSIS
use JSON::Whitespace ':all';
my $in = <<EOF;
{
"animals"
"moons":{
"🌑":0
}
}
EOF
my $minify = json_minify ($in);
print $minify;
This outputs
{"animals":{"kingkong":"🦍"},"baka":["ド
ION
This documents version 0.62 of JSON::Whitespace corresponding to
L<git commit d04630086f6c92fea720cba4568faa0cbbdde5a6|https://github.com/benkasminbullock/JSON-Parse/commit/d04630086f6c92fea720cb
in.com/oauth/v2/authorization",
user_info => "https://api.linkedin.com/v1/people/~?format=json",
},
query_params => {
authorize => {
response_type => 'code',
);
if( $resp->is_success ) {
my $user = $self->_stringify_json_booleans(
JSON::MaybeXS::decode_json( $resp->decoded_content )
);
$session_data->{linkedin}{u
uth_status->payload;
$self->push_onto_context( {
current => $emp->TO_JSON,
current_obj => $emp,
current_priv => $emp->priv( $dbix_conn ),
::Dochazka::REST::Model::Employee" );
$self->push_onto_context( {
current => $emp->TO_JSON,
current_obj => $emp,
current_priv => $emp->priv( $dbix_conn ),
dbix_conn
# From the command line
echo '{"colors":["red","green","blue"]}' |
catmandu convert JSON to Template --template `pwd`/xml.tt
where xml.tt like:
<colors>
[% FOREACH c IN col
}
Note that it should be possible to set a property to null:
{ "fullname" : null }
The JSON will be converted into a Perl hashref, of course, and that will
be handed off to the DBI for inse
und some employee objects
foreach my $emp ( @{ $status->payload } ) {
$emp = $emp->TO_JSON;
}
return $status;
}
=head2 Genreport handlers
=head3 handler_genreport
Handler for t
ntervals converted" );
#
# spawn Schedule object
my @ARGS = ( 'schedule' => $intvls->json );
if ( my $scode = $context->{'request_entity'}->{'scode'} ) {
push @ARGS, ( 'scode'
o this
activity.
=back
=back
=head2 C<< bugreport >>
=over
Allowed methods: GET
Returns a JSON structure containing instructions for reporting bugs.
=back
=head2 C<< component >>
=over
A
qeuest for one of
these subresources, including the resource name in the request
entity as a bare JSON string (i.e. in double quotes).
=back
=head2 C<< docu/html >>
=over
Allowed methods: POST
a new schedule from those intervals or verify that an equivalent
schedule already exists.
Sample JSON:
{ "schedule" : [
"[2014-09-22 08:00, 2014-09-22 12:00)",
"[2014-09-22 12:30