Ref Bool Str Int );
use namespace::autoclean;
use XML::Simple qw( XMLin XMLout );
use JSON::XS ();
use LWP::UserAgent ();
use Time::HiRes qw( gettimeofday tv_interval );
# Bas
s');
has 'ua' => ( is => 'rw', writer => '_set_ua' );
has 'jsonObj' => ( is => 'ro', default => sub {
return JSON::XS->new
->utf8
->allow_nonref
$str = XMLout( $self->payload );
}
when ( m|json| ) {
$str = $self->jsonObj->encode( $self->payload );
}
}
$self->payload(
ompat.h"
#include "bson-macros.h"
#include "bson-types.h"
BSON_BEGIN_DECLS
#define BSON_ERROR_JSON 1
#define BSON_ERROR_READER 2
void bson_set_error (bson_error_t *error,
void);
bson_t *
bson_new_from_json (const uint8_t *data,
ssize_t len,
bson_error_t *error);
bool
bson_init_from_json (bson_t *bson,
valid_type);
/**
* bson_as_json:
* @bson: A bson_t.
* @length: A location for the string length, or NULL.
*
* Creates a new string containing @bson in extended JSON format. The caller
* is res
ference/mongodb-extended-json/ for
* more information on extended JSON.
*
* Returns: A newly allocated string that should be freed with bson_free().
*/
char *
bson_as_json (const bson_t *bson,
YottaDB module from the git repository:
$ # sudo apt install make libextutils-pkgconfig-perl libjson-perl
$ git clone https://gitlab.com/oesiman/yottadb-perl.git
$ cd yottadb-perl
$ perl Makefile
SEE ALSO
This module depends on
L<JSON> for C<ydb_json_import>.
Install it on Debian:
# apt-get install libjson-perl
or via CPAN:
# cpan JSON
L<https://yottadb.com>
=head1 AUTH
O_JSON
#pod
#pod Returns a string for this OID, with the OID given as 24 hex digits.
#pod
#pod If the C<BSON_EXTJSON> option is true, it will instead be compatible with
#pod MongoDB's L<extended JSON|
d-json.rst>
#pod format, which represents it as a document as follows:
#pod
#pod {"$oid" : "012345678901234567890123"}
#pod
#pod =cut
sub TO_JSON {
return $_[0]->hex unless $ENV{BSON_EXTJSON}
.
=head2 TO_JSON
Returns a string for this OID, with the OID given as 24 hex digits.
If the C<BSON_EXTJSON> option is true, it will instead be compatible with
MongoDB's L<extended JSON|https://gith
er;
use Errno qw(:POSIX);
use HTTP::Request;
use HTTP::Status qw(:constants);
use JSON;
use LWP::UserAgent;
use Throw qw(throw classify);
use Try::Tiny qw(try catch);
;
};
if ($status = true) {
return ($JSON::true, $request_struct);
} else {
return ($JSON::false, '{"error":"Entry already exists"}');
}
}
;
};
if ($status = true) {
return ($JSON::true, $request_struct);
} else {
return ($JSON::false, '{"error":"Entry does not exist"}');
}
}
TO_JSON
#pod
#pod If the C<BSON_EXTJSON> option is true, returns a hashref compatible with
#pod MongoDB's L<extended JSON|https://github.com/mongodb/specifications/blob/master/source/extended-json.rs
C<BSON_EXTJSON> option is false, an error is thrown, as this value
#pod can't otherwise be represented in JSON.
#pod
#pod =cut
sub TO_JSON {
my $self = shift;
if ( $ENV{BSON_EXTJSON} ) {
d = $self->id;
if (ref $id) {
$id = $id->TO_JSON;
}
else {
$id = BSON->perl_to_extjson($id);
}
my %data;
tie( %data, 'Tie::IxH
ends 'BSON::DBRef';
sub TO_JSON {
my $self = shift;
if ( $ENV{BSON_EXTJSON} ) {
my $id = $self->id;
if (ref $id) {
$id = $id->TO_JSON;
}
else {
$id = BSON->perl_to_extjson($id);
}
my %data;
tie( %data, 'Tie::IxHash' );
$data{'$ref'} = $self->ref;
$data{'$id'} = $id;
$data{'$db'} = $s
or keys %$extra;
return \%data;
}
Carp::croak( "The value '$self' is illegal in JSON" );
}
1;
=pod
=encoding UTF-8
=head1 NAME
BSON::DBPointer - Legacy BSON type wrapper for DBP
TO_JSON
#pod
#pod If the C<BSON_EXTJSON> option is true, returns a hashref compatible with
#pod MongoDB's L<extended JSON|https://github.com/mongodb/specifications/blob/master/source/extended-json.rs
pod If the C<BSON_EXTJSON> option is false, an error is thrown, as this value
#pod can't otherwise be represented in JSON.
#pod
#pod =cut
sub TO_JSON {
if ( $ENV{BSON_EXTJSON} ) {
my %dat
regularExpression' => \%data,
};
}
Carp::croak( "The value '$_[0]' is illegal in JSON" );
}
1;
=pod
=encoding UTF-8
=head1 NAME
BSON::Regex - BSON type wrapper for regular expre
loud::Object::AMFSaveOption;
require 5.6.0;
use strict;
use warnings;
use utf8;
use JSON qw(decode_json);
use Data::Dumper;
use Module::Runtime qw(use_module);
use Log::Any qw($log);
use Da
turn perl hash
sub to_hash {
return decode_json(JSON->new->convert_blessed->encode( shift ));
}
# used by JSON for serialization
sub TO_JSON {
my $self = shift;
my $_data = {};
eserialize the data
while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
if ($_type =~ /^array\[/i) { # array
eeDCloud::Object::ModelData;
require 5.6.0;
use strict;
use warnings;
use utf8;
use JSON qw(decode_json);
use Data::Dumper;
use Module::Runtime qw(use_module);
use Log::Any qw($log);
use Da
turn perl hash
sub to_hash {
return decode_json(JSON->new->convert_blessed->encode( shift ));
}
# used by JSON for serialization
sub TO_JSON {
my $self = shift;
my $_data = {};
eserialize the data
while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
if ($_type =~ /^array\[/i) { # array
loud::Object::PdfSaveOption;
require 5.6.0;
use strict;
use warnings;
use utf8;
use JSON qw(decode_json);
use Data::Dumper;
use Module::Runtime qw(use_module);
use Log::Any qw($log);
use Da
turn perl hash
sub to_hash {
return decode_json(JSON->new->convert_blessed->encode( shift ));
}
# used by JSON for serialization
sub TO_JSON {
my $self = shift;
my $_data = {};
eserialize the data
while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
if ($_type =~ /^array\[/i) { # array
ject::Discreet3DSSaveOption;
require 5.6.0;
use strict;
use warnings;
use utf8;
use JSON qw(decode_json);
use Data::Dumper;
use Module::Runtime qw(use_module);
use Log::Any qw($log);
use Da
turn perl hash
sub to_hash {
return decode_json(JSON->new->convert_blessed->encode( shift ));
}
# used by JSON for serialization
sub TO_JSON {
my $self = shift;
my $_data = {};
eserialize the data
while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
if ($_type =~ /^array\[/i) { # array
@actions = @_;
my $weak_add;
my $add = sub {
while (@actions) {
my @json = try {
$self->_encode_action( splice( @actions, 0, 2 ) );
}
};
return unless @json;
push @$buffer, @json;
my $size = $self->_buffer_size;
$size += length($_) + 1 for @json;
$self->_buffer_size(
s a queue, buffering up actions
until it reaches a maximum count of actions, or a maximum size of JSON request
body, at which point it issues a C<bulk()> request.
Once you have finished adding action
@_) {
my @json = $self->_encode_action( splice( @_, 0, 2 ) );
push @$buffer, @json;
my $size = $self->_buffer_size;
$size += length($_) + 1 for @json;
$self->
s a queue, buffering up actions
until it reaches a maximum count of actions, or a maximum size of JSON request
body, at which point it issues a C<bulk()> request.
Once you have finished adding action
by setting C<max_count> to C<0>. Defaults to
C<1,000>.
=item * C<max_size>
The maximum size of JSON request body to allow before triggering a
L</flush()>. This can be disabled by setting C<max_siz
wn fox");
=head2 Filter path parameter
Any API which returns a JSON body accepts a C<filter_path> parameter
which will filter the JSON down to only the specified paths. For instance,
if you are run
ent-Type' header
my $_header_accept = $self->{api_client}->select_header_accept('application/json');
if ($_header_accept) {
$header_params->{'Accept'} = $_header_accept;
}
ent-Type' header
my $_header_accept = $self->{api_client}->select_header_accept('application/json');
if ($_header_accept) {
$header_params->{'Accept'} = $_header_accept;
}
ent-Type' header
my $_header_accept = $self->{api_client}->select_header_accept('application/json');
if ($_header_accept) {
$header_params->{'Accept'} = $_header_accept;
}
DCloud::Object::ObjectExist;
require 5.6.0;
use strict;
use warnings;
use utf8;
use JSON qw(decode_json);
use Data::Dumper;
use Module::Runtime qw(use_module);
use Log::Any qw($log);
use Da
turn perl hash
sub to_hash {
return decode_json(JSON->new->convert_blessed->encode( shift ));
}
# used by JSON for serialization
sub TO_JSON {
my $self = shift;
my $_data = {};
eserialize the data
while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
if ($_type =~ /^array\[/i) { # array
@_) {
my @json = $self->_encode_action( splice( @_, 0, 2 ) );
push @$buffer, @json;
my $size = $self->_buffer_size;
$size += length($_) + 1 for @json;
$self->
s a queue, buffering up actions
until it reaches a maximum count of actions, or a maximum size of JSON request
body, at which point it issues a C<bulk()> request.
Once you have finished adding action
by setting C<max_count> to C<0>. Defaults to
C<1,000>.
=item * C<max_size>
The maximum size of JSON request body to allow before triggering a
L</flush()>. This can be disabled by setting C<max_siz
Cloud::Object::ErrorDetails;
require 5.6.0;
use strict;
use warnings;
use utf8;
use JSON qw(decode_json);
use Data::Dumper;
use Module::Runtime qw(use_module);
use Log::Any qw($log);
use Da
turn perl hash
sub to_hash {
return decode_json(JSON->new->convert_blessed->encode( shift ));
}
# used by JSON for serialization
sub TO_JSON {
my $self = shift;
my $_data = {};
eserialize the data
while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
if ($_type =~ /^array\[/i) { # array