Group
Extension

Matches 35359

JQ-Lite ( S/SH/SHINGO/JQ-Lite-1.43.tar.gz, SHINGO, 2025; MetaCPAN )
JQ-Lite/script/jq.pl ( view source; MetaCPAN )
 perl

use strict;
use warnings;
use JSON::PP;
use FindBin;
use lib "$FindBin::Bin/../lib";
use JQ::Lite;

my $query = shift or die "Usage: $0 '.query'\n";
my $json_text = do { local $/; <STDIN> };

m
y $jq = JQ::Lite->new;
my @results = $jq->run_query($json_text, $query);

my $pp = JSON::PP->new->utf8->canonical->pretty;

for my $r (@results) {
    if (!defined $r) {
        print "null\n";
    } 
JQ-Lite ( S/SH/SHINGO/JQ-Lite-1.43.tar.gz, SHINGO, 2025; MetaCPAN )
JQ-Lite/JQ-Lite-1.38/t/median_by.t ( view source; MetaCPAN )
e;

my $json_objects = q([
  { "value": 10 },
  { "value": 30 },
  { "value": 20 }
]);

my $json_even = q([
  { "score": 1 },
  { "score": 3 },
  { "score": 5 },
  { "score": 7 }
]);

my $json_mixed =
  { "score": 3 }
]);

my $json_booleans = q([
  { "flag": true },
  { "flag": false },
  { "flag": true }
]);

my $json_entire_item = q([1, "2", 3, "not a number"]);

my $json_no_numeric = q([
  { "va
dian_objects) = $jq->run_query($json_objects, 'median_by(.value)');
is($median_objects, 20, 'median_by over projected values');

my ($median_even) = $jq->run_query($json_even, 'median_by(.score)');
is
JQ-Lite ( S/SH/SHINGO/JQ-Lite-1.43.tar.gz, SHINGO, 2025; MetaCPAN )
JQ-Lite/JQ-Lite-1.38/t/startswith_endswith.t ( view source; MetaCPAN )
use strict;
use warnings;
use Test::More;
use JSON::PP;
use JQ::Lite;

my $json = q({
  "title": "Hello World!",
  "tags": ["perl", "json", "cli"],
  "names": ["Alice", "Bob", "Alfred"],
  "mixed": ["
_title = $jq->run_query($json, '.title | startswith("Hello")');
ok($starts_title[0], 'startswith() returns true for matching prefix');

my @starts_false = $jq->run_query($json, '.title | startswith("W
ends_title = $jq->run_query($json, '.title | endswith("World!")');
ok($ends_title[0], 'endswith() returns true for matching suffix');

my @ends_false = $jq->run_query($json, '.title | endswith("Hello"
JQ-Lite ( S/SH/SHINGO/JQ-Lite-1.43.tar.gz, SHINGO, 2025; MetaCPAN )
JQ-Lite/JQ-Lite-1.38/t/group_count.t ( view source; MetaCPAN )
re;
use FindBin;
use lib "$FindBin::Bin/../lib";
use JQ::Lite;

my $jq = JQ::Lite->new;

my $json = <<'JSON';
[
  { "name": "Alice", "team": "A" },
  { "name": "Bob",   "team": "B" },
  { "name": "Car
: "A" },
  { "name": "Dave",  "team": "B" },
  { "name": "Eve",   "team": "A" }
]
JSON

my @res = $jq->run_query($json, 'group_count(team)');

is_deeply(
    $res[0],
    {
        A => 3,
        B =
> 2,
    },
    'group_count(team) tallies members per team'
);

@res = $jq->run_query($json, 'group_count(nickname)');

is_deeply(
    $res[0],
    {
        null => 5,
    },
    'group_count on mis
JQ-Lite ( S/SH/SHINGO/JQ-Lite-1.43.tar.gz, SHINGO, 2025; MetaCPAN )
JQ-Lite/JQ-Lite-1.38/t/case_transform.t ( view source; MetaCPAN )
use strict;
use warnings;
use Test::More;
use JQ::Lite;

my $json = q({
  "title": "Hello World",
  "tags": ["Perl", "JSON", "CLI"],
  "users": [
    {"name": "Alice"},
    {"name": "Bob"}
  ]
});

my
json, '.title | lower');
is($scalar_lower[0], 'hello world', 'lower converts scalar to lowercase');

my @array_upper = $jq->run_query($json, '.tags | upper');
is_deeply($array_upper[0], ['PERL', 'JSON
>run_query($json, '.users[] | .name | lower');
is_deeply(\@pipeline_lower, ['alice', 'bob'], 'lower works in pipelines with flattened arrays');

my @scalar_titlecase = $jq->run_query($json, '.title | 
JQ-Lite ( S/SH/SHINGO/JQ-Lite-1.43.tar.gz, SHINGO, 2025; MetaCPAN )
JQ-Lite/JQ-Lite-1.38/t/transpose.t ( view source; MetaCPAN )
;
use JQ::Lite;
use JSON::PP qw(encode_json decode_json);

my $jq = JQ::Lite->new;

my $json = encode_json({ matrix => [ [1, 2, 3], [4, 5, 6] ] });
my @result = $jq->run_query($json, '.matrix | transp
sult[0], $expected, 'transpose pivots arrays of arrays');

$json = encode_json({ jagged => [ [1, 2], [3] ] });
@result = $jq->run_query($json, '.jagged | transpose');
$expected = [ [1, 3] ];
is_deeply
transpose truncates to the shortest row');

$json = encode_json({ numbers => [1, 2, 3] });
my $decoded = decode_json($json);
@result = $jq->run_query($json, '.numbers | transpose');
is_deeply($result[
JQ-Lite ( S/SH/SHINGO/JQ-Lite-1.43.tar.gz, SHINGO, 2025; MetaCPAN )
JQ-Lite/JQ-Lite-1.38/t/setpath.t ( view source; MetaCPAN )
my ($json, $query) = @_;
    return [$jq->run_query($json, $query)];
}

sub encode_json {
    my ($data) = @_;
    require JSON::PP;
    return JSON::PP::encode_json($data);
}

my $json = <<'JSON';
{
  "details": {
    "dimensions": {
      "width": 10,
      "height": 20
    }
  }
}
JSON

my $res = run_query($json, 'setpath(["details", "dimensions", "depth"]; 5)');

is_deeply($res->[0], {
    nam
       depth  => 5,
        },
    },
}, 'setpath() adds missing nested key');

$res = run_query($json, 'setpath(["details", "dimensions", "width"]; 42)');

is_deeply($res->[0], {
    name    => 'widg
JQ-Lite ( S/SH/SHINGO/JQ-Lite-1.43.tar.gz, SHINGO, 2025; MetaCPAN )
JQ-Lite/JQ-Lite-1.38/t/indices.t ( view source; MetaCPAN )
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
CallBackery ( O/OE/OETIKER/CallBackery-0.56.6.tar.gz, OETIKER, 2025; MetaCPAN )
CallBackery/lib/CallBackery/GuiPlugin/AbstractCardlist.pm ( view source; MetaCPAN )
arp croak);
use CallBackery::Translate qw(trm);
use CallBackery::Exception qw(mkerror);
use Mojo::JSON qw(true false);
use POSIX qw(strftime);

=head1 NAME

CallBackery::GuiPlugin::AbstractCardlist - 
JQ-Lite ( S/SH/SHINGO/JQ-Lite-1.43.tar.gz, SHINGO, 2025; MetaCPAN )
JQ-Lite/JQ-Lite-1.38/t/join.t ( view source; MetaCPAN )
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(", ")
JQ-Lite ( S/SH/SHINGO/JQ-Lite-1.43.tar.gz, SHINGO, 2025; MetaCPAN )
JQ-Lite/JQ-Lite-1.38/t/flatten_all.t ( view source; MetaCPAN )
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],
JQ-Lite ( S/SH/SHINGO/JQ-Lite-1.43.tar.gz, SHINGO, 2025; MetaCPAN )
JQ-Lite/JQ-Lite-1.38/t/recurse.t ( view source; MetaCPAN )
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' 
JQ-Lite ( S/SH/SHINGO/JQ-Lite-1.43.tar.gz, SHINGO, 2025; MetaCPAN )
JQ-Lite/JQ-Lite-1.38/t/percentile.t ( view source; MetaCPAN )


my $json_ordered = q([1, 2, 3, 4, 5]);
my ($p0)  = $jq->run_query($json_ordered, 'percentile(0)');
my ($p25) = $jq->run_query($json_ordered, 'percentile(25)');
my ($p50) = $jq->run_query($json_order
ed, 'percentile');
my ($p100) = $jq->run_query($json_ordered, 'percentile(100)');

is($p0, 1, 'percentile(0) returns the minimum value');
is($p25, 2, 'percentile(25) returns the first quartile');
is($
) returns the maximum value');

my $json_interp = q([10, 20, 30, 40]);
my ($p90) = $jq->run_query($json_interp, 'percentile(0.90)');
my ($p75) = $jq->run_query($json_interp, 'percentile(75)');

is($p9
JQ-Lite ( S/SH/SHINGO/JQ-Lite-1.43.tar.gz, SHINGO, 2025; MetaCPAN )
JQ-Lite/JQ-Lite-1.38/t/test_function.t ( view source; MetaCPAN )
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
CallBackery ( O/OE/OETIKER/CallBackery-0.56.6.tar.gz, OETIKER, 2025; MetaCPAN )
CallBackery/lib/CallBackery/GuiPlugin/AbstractAction.pm ( view source; MetaCPAN )
y::Translate qw(trm);
use CallBackery::Exception qw(mkerror);
use Mojo::Promise;
use Mojo::JSON qw(encode_json);
use Mojo::Util qw(dumper);

=head1 NAME

CallBackery::GuiPlugin::AbstractAction - actio
>{PLUGIN}{prototype}{$name}) {
                my $newCfg = encode_json($button->{backend});
                my $oldCfg = encode_json($cfg->{PLUGIN}{prototype}{$name}{backend});
                if ($o
CallBackery ( O/OE/OETIKER/CallBackery-0.56.6.tar.gz, OETIKER, 2025; MetaCPAN )
CallBackery/lib/CallBackery/GuiPlugin/Users.pm ( view source; MetaCPAN )
ractTable';
use CallBackery::Translate qw(trm);
use CallBackery::Exception qw(mkerror);
use Mojo::JSON qw(true false);

=head1 NAME

CallBackery::GuiPlugin::Users - User Plugin

=head1 SYNOPSIS

 use 
App-Rakubrew ( P/PA/PATRICKB/App-Rakubrew-45.tar.gz, PATRICKB, 2025; MetaCPAN )
App-Rakubrew/lib/App/Rakubrew/Download.pm ( view source; MetaCPAN )
 = qw(Exporter);
our @EXPORT = qw();

use strict;
use warnings;
use 5.010;
use HTTP::Tinyish;
use JSON;
use Config;
use Cwd qw(cwd);
use IO::Uncompress::Unzip qw( $UnzipError );
use File::Path qw( mak
release_index_url. Error: $res->{status} $res->{reason}";
        exit 1;
    }
    return decode_json($res->{content});
}

sub _untar {
    my ($data, $target) = @_;
    my $back = cwd();
    chdir $
JQ-Lite ( S/SH/SHINGO/JQ-Lite-1.43.tar.gz, SHINGO, 2025; MetaCPAN )
JQ-Lite/JQ-Lite-1.38/t/delpaths.t ( view source; MetaCPAN )
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
CallBackery ( O/OE/OETIKER/CallBackery-0.56.6.tar.gz, OETIKER, 2025; MetaCPAN )
CallBackery/lib/CallBackery/GuiPlugin/Abstract.pm ( view source; MetaCPAN )
en3;
use POSIX qw<F_SETFD F_GETFD FD_CLOEXEC>;
use Time::HiRes qw(usleep);
use Mojo::JSON qw(encode_json decode_json true false);
use Mojo::File;
use Scalar::Util 'weaken';
# disable warnings below, o
=> 'Title of the Plugin Tab'
        },
    };
};

=head2 schema

A very simple minded grammar to json-schema convertor with no magic.
Better supply a proper schema.

=cut

has schema => sub {
    my 
 and removes all occurrences of the given
key.

CODE references get turned into 'true' values and JSON true/false get
passed on.

=cut

sub filterHashKey {
    my $self = shift;
    my $data = shift;
JQ-Lite ( S/SH/SHINGO/JQ-Lite-1.43.tar.gz, SHINGO, 2025; MetaCPAN )
JQ-Lite/JQ-Lite-1.38/t/leaf_paths.t ( view source; MetaCPAN )
::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 ],

Powered by Groonga
Maintained by Kenichi Ishigaki <ishigaki@cpan.org>. If you find anything, submit it on GitHub.