es->code,message=>$res->message,body=>($res->body//''))->throw if $res->is_error;
my $j = $res->json; $token = $j->{access_token}; $refresh = $j->{refresh_token}//$refresh; $expires_at = time + ($j-
es->code,message=>$res->message,body=>($res->body//''))->throw if $res->is_error;
my $j = $res->json; $token = $j->{access_token}; $refresh = $j->{refresh_token}//$refresh; $expires_at = time + ($j-
#----------------------------------------------------------------------------
## JSON Schema Validator - ~/lib/App/jsonvalidate.pm
## Version v0.1.0
## Copyright(c) 2025 DEGUEST Pte. Ltd.
## Author: J
self.
##----------------------------------------------------------------------------
package App::jsonvalidate;
use strict;
use warnings;
use vars qw( $VERSION );
our $VERSION = 'v0.1.0';
sub init
{
__END__
=encoding utf-8
=head1 NAME
App::jsonvalidate - App harness for the jsonvalidate CLI
=head1 SYNOPSIS
Run C<jsonvalidate -h> or C<perldoc jsonvalidate> for more options.
=head1 VERSION
ore;
use JQ::Lite;
my $json = q({
"users": [
{"name": "Alice", "age": 30},
{"name": "Bob", "age": 25},
{"name": "Carol", "age": 35}
],
"tags": ["perl", "json", "cli"],
"title": "j
,
"flags": [true, false, true]
});
my $jq = JQ::Lite->new;
my @object_index = $jq->run_query($json, '.users | index({"name":"Bob","age":25})');
is(scalar @object_index, 1, 'object index returns si
ray_index = $jq->run_query($json, '.tags | index("perl")');
is($array_index[0], 0, 'scalar array search returns zero-based index');
my @string_index = $jq->run_query($json, '.title | index("lite")');
use strict;
use warnings;
use Test::More;
use JQ::Lite;
my $json = q({
"text": "foo,bar,baz",
"users": [
{ "name": "Alice" },
{ "name": "Bob" }
],
"mixed": ["alpha beta", null, ["inne
y @comma = $jq->run_query($json, '.text | split(",")');
is_deeply($comma[0], [qw(foo bar baz)], 'split(",") breaks comma-separated string');
my @chars = $jq->run_query($json, '.users[0].name | split(
ars[0], [qw(A l i c e)], 'split("") returns individual characters');
my @array = $jq->run_query($json, '.mixed | split(" ")');
my $expected = [
[qw(alpha beta)],
[],
[[qw(inner)]],
{
rnings;
use Test::More;
use JQ::Lite;
my $json = '{"row":["foo","bar","baz,qux","he said \"hi\""]}';
my $jq = JQ::Lite->new;
my @row = $jq->run_query($json, '.row | @csv');
is_deeply(\@row, ['"foo"
jq->run_query($json, '.row[0] | @csv');
is_deeply(\@single, ['"foo"'], '@csv formats scalar values as CSV fields');
my $mixed_json = '["42", 42]';
my @mixed = $jq->run_query($mixed_json, '@csv');
is_
Test::More tests => 4;
use FindBin;
use lib "$FindBin::Bin/../lib";
use JQ::Lite;
use JSON::PP;
my $json = <<'EOF';
{
"users": [
{ "name": "Alice", "age": 30 },
{ "name": "Bob", "
$jq->run_query($json, '.users[] | .name');
is_deeply(\@names, ["Alice", "Bob", "Charlie"], 'Extract names from users array');
# Test: users[].age
my @ages = $jq->run_query($json, '.users[] | .a
n_query($json, '.users[].name');
is_deeply(\@alt, ["Alice", "Bob", "Charlie"], 'Alternative syntax for extracting names');
# Test: top-level object access
my @all = $jq->run_query($json, '.user
se Test::More;
use JQ::Lite;
my $json = q({
"meta": {
"version": "1.0",
"author": "you"
}
});
my $jq = JQ::Lite->new;
my @result1 = $jq->run_query($json, 'select(.meta has "version")');
use strict;
use warnings;
use Test::More;
use JQ::Lite;
my $json = q({
"tags": ["perl", "json", "perl", "cli"],
"phrase": "banana",
"users": [
{"name": "Alice"},
{"name": "Bob"},
{"
es = $jq->run_query($json, '.tags | indices("perl")');
is_deeply($tag_indices[0], [0, 2], 'indices() finds all matching array positions');
my @user_indices = $jq->run_query($json, '.users | indices({
dices = $jq->run_query($json, '.numbers | indices(2)');
is_deeply($number_indices[0], [1, 3], 'indices() handles numeric comparisons');
my @bool_indices = $jq->run_query($json, '.mixed | indices(true
er traverses nested values' => sub {
my $json = q({
"name": "alice",
"roles": ["dev", "ops"]
});
my @results = $jq->run_query($json, 'recurse');
is(scalar @results, 5, 'e
ent');
};
subtest 'recurse with filter follows custom child relationships' => sub {
my $tree_json = q({
"name": "root",
"children": [
{ "name": "child1" },
{ "name": "
ld2", "children": [ { "name": "grand" } ] }
]
});
my @names = $jq->run_query($tree_json, 'recurse(.children[]?) | .name');
is_deeply(\@names, [ 'root', 'child1', 'child2', 'grand'
::More tests => 6;
use JSON::PP;
use JQ::Lite;
my $jq = JQ::Lite->new;
# --- 1. Nested object with arrays and booleans
my $json1 = '{"user":{"name":"Alice","tags":["perl","json"],"active":true}}';
m
y @result1 = $jq->run_query($json1, 'leaf_paths');
is_deeply(
$result1[0],
[
[ 'user', 'active' ],
[ 'user', 'name' ],
[ 'user', 'tags', 0 ],
[ 'user', 'tags',
paths',
);
# --- 2. Mixed array contents with nested objects
my $json2 = '[1,{"foo":[2,null]}]';
my @result2 = $jq->run_query($json2, 'leaf_paths');
is_deeply(
$result2[0],
[
[ 0 ],
use Test::More;
use JQ::Lite;
my $json = '{"users":[{"name":"Alice"},{"name":"Bob"},{"name":"Carol"}]}';
my $jq = JQ::Lite->new;
my @result = $jq->run_query($json, '.users | map(.name) | join(", ")
n object
my $json_object = <<'JSON';
{
"profile": {
"name": "Alice",
"password": "secret",
"tokens": ["abc", "def"]
}
}
JSON
my @result_object = $jq->run_query(
$json_object,
Delete array entries by index
my $json_array = <<'JSON';
{
"items": [
{"id": 1},
{"id": 2},
{"id": 3}
]
}
JSON
my @result_array = $jq->run_query($json_array, '.items | delpaths([[1]])
ts by index'
);
# --- 3. Removing the root path yields null
my $json_scalar = '{"keep": true}';
my @result_null = $jq->run_query($json_scalar, '. | delpaths([[]])');
ok(!defined $result_null[0], 'de
use strict;
use warnings;
use Test::More;
use JSON::PP;
use JQ::Lite;
my $structure = {
profile => {
name => 'Alice',
age => 30,
emails => [
'alice@exampl
meta => {
active => JSON::PP::true,
},
},
};
my $json = encode_json($structure);
my $jq = JQ::Lite->new;
my @name = $jq->run_query($json, '.profile | getpath(["name"])');
l = $jq->run_query($json, '.profile | getpath(["emails", 1])');
is($email[0], 'alice.work@example.com', 'getpath retrieves nested array index');
my @missing = $jq->run_query($json, '.profile | getpat
use strict;
use warnings;
use Test::More;
use JSON::PP;
use JQ::Lite;
my $json = q({
"title": "Hello World",
"tags": ["perl", "json", "cli"],
"mixed": ["abc123", null, 42, {"kind": "object"}]
}
ew;
my @prefix = $jq->run_query($json, '.title | test("^Hello")');
ok($prefix[0], 'test() matches prefix anchored regex');
my @case_sensitive = $jq->run_query($json, '.title | test("world")');
ok(!$
insensitive = $jq->run_query($json, '.title | test("world"; "i")');
ok($case_insensitive[0], 'test() honours case-insensitive flag');
my @array_map = $jq->run_query($json, '.tags | test("^p")');
is_d
in/../lib";
use JQ::Lite;
my $jq = JQ::Lite->new;
my $json_nested = <<'JSON';
[1, [2, 3], [[4], 5], 6]
JSON
my @nested = $jq->run_query($json_nested, 'flatten_all');
is_deeply($nested[0], [1, 2, 3
ten_all recursively flattens nested arrays');
my $json_mixed = <<'JSON';
[{"values":[1,2]}, [3, [4, [5]]], 6]
JSON
my @mixed = $jq->run_query($json_mixed, 'flatten_all');
is_deeply(
$mixed[0],
e_demo_setup}<';
};
my $openldap_setup_summary=sub {
package openldap_setup_summary;
use JSON::XS;
my $region="]T[{awsregions}";
$region=~s/^"//;
$region=~s/"$//;
my $type="]T[{se
ication. It is
responsible for publishing the deduplicated entries to a specified format
(Atom or JSON).
=head1 SYNOPSIS
use App::FeedDeduplicator::Publisher;
my $publisher = App::FeedDedup
App::FeedDeduplicator::Publisher. The constructor
accepts an arrau of entries, a format (Atom or JSON), and a maximum number of
entries as parameters.
The entries should be an array reference contai
hould contain a hash reference with the feed information.
The format should be either 'Atom' or 'JSON', and the maximum number of
entries specifies how many entries to include in the output.
=head2
X::StrictConstructor
MooseX::NonMoose
Business::ISBN
App::FatPacker
JSON
JSON::XS
Test::DistManifest
Term::Size::Any
Type::Tiny
File::ReadBackwar
####
INSTALLING Catalyst::View::JSON
########################################
END
print $show;
sleep 1;
cmd_raw($handle,'sudo cpan Catalyst::View::JSON','__display__');
$show=<<END;
e_demo_setup}<';
};
my $catalyst_setup_summary=sub {
package catalyst_setup_summary;
use JSON::XS;
my $region="]T[{awsregions}";
$region=~s/^"//;
$region=~s/"$//;
my $type="]T[{se
table
#pod for piping into F<cpanm>.
#pod
#pod =head2 --json
#pod
#pod Lists all prerequisites in JSON format, as they would appear in META.json
#pod (broken out into phases and types)
#pod
#pod =head
g' ],
[ 'cpanm-versions', 'format versions for consumption by cpanm' ],
[ 'json', 'list dependencies by phase, in JSON format' ],
[ 'omit-core=s', 'Omit dependencies that are shipped with the sp
if($opt->json) {
my $prereqs = $self->prereqs($self->zilla);
$prereqs = filter_core($prereqs, $omit_core) if $omit_core;
my $output = $prereqs->as_string_hash;
require JSON::MaybeXS;
}
if (-f 'META.json') {
my $meta = CPAN::Meta->load_file('META.json');
if (!$meta->dynamic_config) {
return { type => 'metafile', path => 'META.json' };
}
PL';
my @cmd = ($^X, $build_file);
warn "Executing $build_file to generate MYMETA.json and to determine requirements...\n";
local %ENV = (
PERL5_CPAN_IS_RUNNING =>
}
if (!-f 'MYMETA.json') {
die "Error: No MYMETA.json after executing $build_file\n";
}
return { type => 'metafile', path => 'MYMETA.json' };
}
return;
}