for your Teams webhook
=head2 json [optional]
This is optional and allow you to provide an alternate JSON object
to format the output sent to post queries.
One JSON::MaybeXS with the flavor of you
use DateTime::Format::Human::Duration;
use Encode;
use HTTP::Tiny;
use JSON::XS;
field $url : param;
field $json : param = undef;
field $auto_detect_utf8 : param = 1;
field
ers => {
'Content-Type' => 'application/json; charset=UTF-8'
}
);
$json = JSON::XS->new->utf8(0)->pretty(1) unless (defined($json));
}
#<<V perltidy can't handle Object::Pad'
Client;
use strict;
use warnings;
use Data::Dumper;
use HTTP::Request::Common;
use JSON qw(decode_json encode_json);
use List::Util qw(first);
use LWP::UserAgent;
use Mozilla::CA;
use Scalar::Util;
'client_secret' => $args->{'client_secret'},
'format_type' => $args->{'format_type'} || 'json',
'lwp' => LWP::UserAgent->new,
'rapidapi_key' => $args->{'rapidapi_key'},
se {
my $decoded = eval { decode_json $response->decoded_content };
if (my $err = $@) {
die "An error occurred while trying to json decode imgur response: $err\n" . $respon
with optional args (e.g. Foo::Bar=arg1,arg2)",
"of" => [
[
"array_from_json",
{
max_len => 2,
min_len => 1,
elems => [
INITION
do {
my $a = [
"any",
{
"of" => [
[
"array_from_json",
{
max_len => 2,
min_len => 1,
elems => [
r\n Foo::Bar=arg1,arg2\n\nSee also: `perl::modname`.\nA two-element array from (coercible from JSON string) is also allowed:\n\n [\"Foo::Bar\", \\\@args]\n\n",examples=>[{valid=>0,value=>""},{va
"]]},{summary=>"Too many elements",valid=>0,value=>["Foo",["arg1","arg2"],{}]}],of=>[["array_from_json",{description=>"\nThese are valid values for this schema:\n\n [\"Foo\"]
e extensions (if possible)
=item * No extra meta files like C<dist.ini>, C<.travis.yml>, C<bower.json> etc
=back
These are the I<best of> from all the package systems I've used. They make me
happy,
-pm>
=item * L<https://github.com/ingydotnet/io-all-pm>
=item * L<https://github.com/ingydotnet/jsony-pm>
=item * L<https://github.com/ingydotnet/js-pm>
=item * L<https://github.com/ingydotnet/jsy
* L<https://github.com/ingydotnet/pegex-forth-pm>
=item * L<https://github.com/ingydotnet/pegex-json-pm>
=item * L<https://github.com/ingydotnet/pegex-vcard-pm>
=item * L<https://github.com/ingydo
)';
binmode STDIN, ':encoding(UTF-8)';
use Getopt::Long qw(:config no_ignore_case);
use Config::JSON::Enhanced;
use Data::Roundtrip qw/perl2yaml no-unicode-escape-permanently/;
my $OUTPUT_FILE = un
ub usage { return
"Usage : $0 [--I inputstring] [--i 'afile.json'] [--o afile] [--c commentstyle] [--tags tags]\n"
."\nIt will read a JSON string from command line (-I), or from a file (-i)\n"
."\n
local $/; <STDIN> }
}
my $result = Config::JSON::Enhanced::config2perl(\%params);
if( ! defined $result ){ print STDERR "$0 : error, call to ".'Config::JSON::Enhanced::config2perl()'." has failed.\n"
ngs;
use App::ElasticSearch::Utilities qw(:all);
use CLI::Helpers qw(:all);
use Const::Fast;
use JSON::MaybeXS;
use Getopt::Long::Descriptive;
use Pod::Usage;
#--------------------------------------
$opt->manual;
#------------------------------------------------------------------------#
my $json = JSON->new->pretty->utf8->canonical;
my %indices = map { $_ => (es_index_days_old($_) || 0) } es_i
> join(',', sort keys %fields),
bytes => 'b',
format => 'json'
}
}
);
$cache->set('_cat/indices', $result);
}
foreach my $
RACT: Run to apply a JSON list of settings to indexes matching a pattern
use strict;
use warnings;
use App::ElasticSearch::Utilities qw(:all);
use CLI::Helpers qw(:all);
use JSON::MaybeXS;
use Getopt
Read JSON Settings
my $RawJSON = '';
$RawJSON .= $_ while <>;
my $settings = undef;
eval {
$settings = decode_json $RawJSON;
};
if( my $err = $@ ) {
output({color=>'red'}, "Invalid JSON stru
cture passed, error was '$err'");
debug('JSON Passed was:', $RawJSON);
exit 1;
}
debug("Settings to apply");
debug_var($settings);
# Delete Indexes older than a certain point
my @indices = es
posix_default no_ignore_case no_ignore_case_always);
use Hash::Merge::Simple qw(clone_merge);
use JSON::MaybeXS;
use Pod::Usage;
use Ref::Util qw(is_hashref);
use Time::HiRes qw(time);
#-------------
-----------------------------------------------------------------------#
# Build the Query
my $JSON = JSON->new->pretty->canonical;
my $qs = App::ElasticSearch::Utilities::QueryString->new();
my $q =
eval {
push @settings, $JSON->decode($content);
1;
} or do {
debug($content);
die "Parsing JSON from $OPT{settings} failed: $@";
ile_url('metacpan', 'share/image/image1.jpg');
my $url = $obj->get_dist_file_url('github', 'META.json');
Known hosting:
=over
=item * metacpan
This is the default because all distributions upload
424
=head1 SYNOPSIS
# From the command line
$ catmandu import JSON to DBI --data_source SQLite:mydb.sqlite < data.json
# Or via a configuration file
$ cat catmandu.yml
---
s
$ catmandu import JSON to mydb < data.json
$ catmandu export mydb to YAML > data.yml
$ catmandu export mydb --id 012E929E-FF44-11E6-B956-AE2804ED5190 to JSON > record.json
$ catmandu cou
Only MySQL, PostgreSQL
=item json
Only PostgreSQL
This is mapped internally to postgres field of type "jsonb".
Please use the serializer L<Catmandu::Serializer::json_string>,
if you choose to st
brev);
use Hash::Flatten qw(flatten);
use Hash::Merge::Simple qw(clone_merge);
use IPC::Run3;
use JSON::MaybeXS;
use LWP::UserAgent;
use Net::Netrc;
use Ref::Util qw(is_ref is_arrayref is_hashref);
us
:ElasticSearch::Utilities::QueryString::FileExpansion
If the match ends in .dat, .txt, .csv, or .json then we attempt to read a file with that name and OR the condition:
$ cat test.dat
50 1
2.3.7
Or
$ cat test.txt
1.2.3.4
1.2.3.5
1.2.3.6
1.2.3.7
Or
$ cat test.json
{ "ip": "1.2.3.4" }
{ "ip": "1.2.3.5" }
{ "ip": "1.2.3.6" }
{ "ip": "1.2.3.7" }
that file:
src_ip:test.dat => src_ip:(1.2.3.4 1.2.3.5 1.2.3.6 1.2.3.7)
src_ip:test.json[ip] => src_ip:(1.2.3.4 1.2.3.5 1.2.3.6 1.2.3.7)
This make it simple to use the --data-file outpu
RSION = '8.8'; # VERSION
use CLI::Helpers qw(:output);
use File::Slurp::Tiny qw(read_lines);
use JSON::MaybeXS;
use Ref::Util qw(is_ref is_arrayref is_hashref);
use Text::CSV_XS;
use namespace::autoc
ers = (
txt => \&_parse_txt,
dat => \&_parse_txt,
csv => \&_parse_csv,
json => \&_parse_json,
);
sub handle_token {
my($self,$token) = @_;
my $makeMatcher = sub {
}
}
}
return \%uniq;
}
sub _parse_json {
my ($file,$field) = @_;
die "For new line delimited JSON, please specify the key, ie <field>:$file\[key.path.i.want\]"
PIs
use v5.16;
use warnings;
no warnings 'uninitialized';
our $VERSION = '8.8'; # VERSION
use JSON::MaybeXS;
use Ref::Util qw(is_ref is_arrayref is_hashref);
use parent 'HTTP::Request';
sub new
$class = shift;
my $self = $class->SUPER::new(@_);
$self->header('Accept' => 'application/json');
return $self;
}
sub content {
my ($self,$body) = @_;
if( is_arrayref($body) ) {
sh @body, ref $entry ? encode_json($entry) : $entry;
}
$body = join '', map { "$_\n" } @body;
$self->header('Content-Type' => 'application/x-ndjson');
}
elsif( is_hashr
'; # VERSION
use App::ElasticSearch::Utilities qw(es_connect);
use CLI::Helpers qw(:output);
use JSON::MaybeXS;
use Ref::Util qw(is_ref is_arrayref is_hashref);
use Types::Standard qw( ArrayRef Bool
{
uri_param => {
local => 'true',
format => 'json',
bytes => 'b',
h => join(',', qw( index prirep docs store id st
andu import JSON to DBI --data_source dbi:SQLite:mydb.sqlite < data.json
# Export data from a relational database
$ catmandu export DBI --data_source dbi:SQLite:mydb.sqlite to JSON
# Or
import JSON to mydb < data.json
$ catmandu export mydb to YAML > data.yml
# Export one record
$ catmandu export mydb --id 012E929E-FF44-11E6-B956-AE2804ED5190 to JSON > record.json
#
se JSON::MaybeXS qw(:legacy);
use Pod::Usage;
use POSIX qw(strftime);
use Ref::Util qw(is_ref is_arrayref is_hashref);
use Time::HiRes qw(sleep time);
use YAML::XS;
local $YAML::XS::Boolean = "JSON::P
bg-filter=s
by=s
desc
exists=s@
fields
filter
format=s
help|h
json|jq
manual|m
match-all
max-batch-size=i
missing=s@
no-decorators|no-header
size => ($OPT{size} && $OPT{size} > 0) ? int($OPT{size}) : 20,
format => $OPT{json} ? 'json'
: $OPT{format} ? lc $OPT{format}
: 'yaml',
'max-batch-si