d for convenience.
=over
=item L<AWS::Lambda>
=item L<AWS::XRay>
=item L<JSON>
=item L<Cpanel::JSON::XS>
=item L<JSON::MaybeXS>
=item L<YAML>
=item L<YAML::Tiny>
=item L<YAML::XS>
=item L<Ne
tem L<Cpanel::JSON::XS> 4.39
=item L<DBD::Pg> 3.18.0
=item L<FU> 1.2
=item L<HTML::Tiny> 1.08
=item L<JSON::PP> 4.16
=item L<JSON::SIMD> 1.06
=item L<JSON::Tiny> 0.58
=item L<JSON::XS> 4.03
=i
L::Writer> 0.900
=back
=head1 BENCHMARKS
=head2 JSON Parsing & Formatting
These benchmarks run on large-ish arrays with repeated values. JSON encoding is
sufficiently fast that Perl function cal
interesting.
Also worth noting that L<JSON::SIMD> formatting code is forked from
L<JSON::XS>, the SIMD parts are only used for parsing.
API object from L<JSON::XS> documentation.
# Error objects should be plain data structures so that they can easily
# be converted to JSON for debugging. We have to stringify $reg in the
# error object to ensure that.
+{
0;
}
sub _fmtkey($k) { $k =~ /^[a-zA-Z0-9_-]+$/ ? $k : FU::Util::json_format($k); }
sub _fmtval($v) { eval { $v = FU::Util::json_format($v) }; "$v" }
sub _inval($t,$v) { sprintf 'invalid %s: %s',
neral structure described by the schema and is
mainly useful to ensure that encoding the value as JSON will end up with the
correct data types. i.e. booleans are encoded as booleans, integers as integ
for the string format yet)
=item json / jsonb
These types are converted through C<json_parse()> and C<json_format()> from
L<FU::Util>.
While C<null> is a valid JSON value, there's currently no way
SQL C<NULL>.
If you prefer to work with JSON are raw text values instead, use:
$conn->set_type(json => 'text');
That doesn't I<quite> work for the C<jsonb> type. I mean, it works, but then
there
Encode ();
use POSIX ();
use experimental 'builtin';
our @EXPORT_OK = qw/
to_bool
json_format json_parse
has_control check_control utf8_decode
uri_escape uri_unescape
query_decod
AME
FU::Util - Miscellaneous Utility Functions
=head1 SYNOPSIS
use FU::Util qw/json_format/;
my $data = json_format [1, 2, 3];
=head1 DESCRIPTION
A bunch of functions that are too small (or
rialiser> (which is used by L<JSON::XS>, L<JSON::SIMD>, L<CBOR::XS>
and others), L<JSON::PP> (also used by L<Cpanel::JSON::XS> and others),
L<JSON::Tiny> and L<Mojo::JSON>.
This function is ambiguous
x-icon
jpeg image/jpeg
jpg image/jpeg
js application/javascript
json application/json
jxl image/jxl
mjs application/javascript
mp3 audio/mpeg
mp4
l
xsl application/xml
zip application/zip
zst application/zstd
}} }
# XML & JSON generally don't need a charset parameter
sub utf8_mimes { state $v = {map +($_,1), qw{
applic
state $v = {map +($_,1), qw{
application/atom+xml
application/javascript
application/json
application/rss+xml
application/xml
image/svg+xml
text/css
text/csv
text/
package ClarID::Tools::Validator;
use strict;
use warnings;
use utf8;
use JSON::Validator;
use JSON::Validator::Schema;
use Term::ANSIColor qw(:constants);
use Exporter 'import';
our @EXPORT_OK = qw(v
schema, $debug) = @_;
ClarID::Tools::Validator::_self_validate($schema) if $debug;
my $jv = JSON::Validator->new;
$jv->schema($schema);
my @errors = $jv->validate($data);
if (@errors) {
ub _self_validate {
my ($schema) = @_;
my $validator = JSON::Validator::Schema->new($schema);
die "Invalid JSON Schema\nSee https://json-schema.org/" if $validator->is_invalid;
print "Codebook
roak);
use YAML::XS qw(LoadFile);
use JSON::XS qw(decode_json);
use Exporter 'import';
our @EXPORT_OK = qw( load_yaml_file load_json_file );
# Load a YAML file, ensure it’s a HA
return $data;
}
# Load a JSON file, ensure it’s a HASHREF
sub load_json_file {
my ($file) = @_;
open my $fh, '<', $file
or croak "Error opening JSON file '$file': $!";
local
$/;
my $text = <$fh>;
close $fh;
my $data = eval { decode_json($text) };
croak "Error parsing JSON in '$file': $@" if $@;
croak "Expected a HASH in '$file'" unless ref $data eq 'HA
o;
use strict;
use warnings;
use 5.010;
use Carp;
use autodie;
use utf8;
use Moo;
use JSON;
extends qw/Zabbix7::API::CRUDE/;
sub id {
my ($self, $value) = @_;
if (defined $va
$self->_prefix('ids') => [ $self->id ],
globalmacro => $self->globalp ? JSON::true : JSON::false,
$self->_extension
}
)->[0];
croak(sprintf(q{%s cla
$self->_prefix('ids') => [ $self->id ],
globalmacro => $self->globalp ? JSON::true : JSON::false,
countOutput => 1,
}
);
Log::Any->get_logger->debug
blessed/;
use Module::Loaded;
use Module::Load;
use Params::Validate qw/validate :types/;
use JSON;
use LWP::UserAgent;
use Log::Any;
our $VERSION = '1.1';
has 'server' => (is => 'ro', req
'Content-Type' => 'application/json-rpc',
Content => encode_json({
jsonrpc => '2.0',
$error, $response->code, $response->message);
}
my $decoded = eval { decode_json($response->decoded_content) };
if (my $error = $@) {
# no good either
cr
mmon.c"
#include "c/compress.c"
#include "c/fcgi.c"
#include "c/fdpass.c"
#include "c/jsonfmt.c"
#include "c/jsonparse.c"
#include "c/xmlwr.c"
#include "c/libpq.h"
#include "c/pgtypes.c"
#include "c
&PL_sv_yes : &PL_sv_no;
void json_format(SV *val, ...)
CODE:
ST(0) = fujson_fmt_xs(aTHX_ ax, items, val);
void json_parse(SV *val, ...)
CODE:
ST(0) = fujson_parse_xs(aTHX_ ax, items, val
($self) = @_;
if ( $self->{messages} ) {
return @{ $self->{messages} };
}
return;
}
sub TO_JSON {
my ($self) = @_;
my $ret = { %{$self} };
for my $k ( keys %{$ret} ) {
if ( ref( $ret->{$
cess::VERSION = '0.43';
use parent 'Exporter';
use Net::Proxmox::VE::Exception;
use JSON::MaybeXS qw(decode_json);
our @EXPORT = qw(
access
access_domains access_groups access_roles
create_ac
------------------------------------------------------------
# Process 'gdat' atom Base64-encoded JSON-format timed GPS used by Nextbase software (ref PH)
# Inputs: 0) ExifTool ref, 1) dirInfo ref, 2)
Pt);
my (%dbase, $fix);
require Image::ExifTool::Import;
Image::ExifTool::Import::ReadJSON($dataPt, \%dbase);
my $info = $dbase{'*'} or return 0;
$et->HandleTag($tagTbl, CameraMode
::Bootstrap;
use 5.026000;
use utf8;
use strict;
use warnings;
use HTTP::Tiny;
use JSON::XS qw/decode_json encode_json/;
use Try::Tiny;
use AWS::Lambda;
use AWS::Lambda::Context;
use AWS::Lambda::Resp
t: $resp->{status} $resp->{reason}";
}
my $h = $resp->{headers};
my $payload = decode_json($resp->{content});
return $payload, AWS::Lambda::Context->new(
deadline_ms =
ion/${request_id}/response";
my $resp = $self->{http}->post($url, {
content => encode_json($response),
});
if (!$resp->{success}) {
die "failed to response of execution: $r
echanize::Chrome;
use Encode qw/encode_utf8 decode_utf8/;
use Mojo::Log;
use FindBin;
use Config::JSON::Enhanced;
use Data::Roundtrip qw/perl2dump no-unicode-escape-permanently/;
use WWW::Mechanize::C
$domops_VERBOSITY
$domops_LOGGER
/;
# a basic default configuration file in enhanced JSON (see L<Config::JSON::Enhanced>)
my $DEFAULT_CONFIGSTRING = <<'EOCS';
</* $VERSION = '0.05'; */>
</* comment
le-substitutions' => {
'SCRIPTDIR' => Cwd::abs_path($FindBin::Bin),
},
};
my $ch = Config::JSON::Enhanced::config2perl($xp);
if( ! defined $ch ){ $log->error("Configuration parameters:\n".perl
trptime;
use Digest::MD5 qw(md5_hex);
use Encode qw(decode encode);
use IO::Socket::SSL;
use JSON;
use LWP::UserAgent;
use Travel::Status::DE::HAFAS::Journey;
use Travel::Status::DE::HAFAS::Locat
my $json = $self->{json} = JSON->new->utf8;
# The JSON request is the cache key, so if we have a cache we must ensure
# that JSON serialization is deterministic.
if ( $self->{cache} ) {
$json->c
anonical;
}
$req = $json->encode($req);
$self->{post} = $req;
my $url = $conf{url} // $hafas_instance->{$service}{mgate};
if ( my $salt = $hafas_instance->{$service}{salt} ) {
if ( $hafas_in
die '$LAMBDA_TASK_ROOT is not found';
my $content_type = $args{content_type} // 'application/json';
my $self = bless +{
response_url => $response_url,
http => $http,
_;
my $json = $conf{json};
my $is_him = $conf{is_him};
my $short = $json->{txtS};
my $text = $json->{txtN};
my $type = $json->{type};
my $code = $json->{code};
my $prio = $json->{prio};
if ($is_him) {
$short = $json->{head};
$text = $json->{text};
$code = $json->{hid};
}
my $ref = {
short => $short,
text => $text,
type => $type,
code => $code,
=> $is_him,
ref_count => $conf{ref_count},
};
bless( $ref, $obj );
return $ref;
}
sub TO_JSON {
my ($self) = @_;
return { %{$self} };
}
1;
__END__
=head1 NAME
Travel::Status::DE::HAFAS
se strict;
use warnings;
use 5.014;
use utf8;
use Carp qw(confess);
use Encode qw(decode);
use JSON;
use LWP::UserAgent;
our $VERSION = '6.23';
# {{{ Constructors
sub new {
my ( $obj, %conf ) =
on [(] [)] ; $ }{}x;
if ( $ref->{developer_mode} ) {
say $ref->{raw_reply};
}
$ref->{json} = from_json( $ref->{raw_reply} );
return $ref;
}
sub new_p {
my ( $obj, %conf ) = @_;
my $promise
; $ }{}x;
if ( $self->{developer_mode} ) {
say $self->{raw_reply};
}
$self->{json} = from_json( $self->{raw_reply} );
$promise->resolve( $self->results );
return;
}
)->catch(