JQ::Lite

JQ::Lite is a lightweight, pure-Perl JSON query engine inspired by the jq command-line tool.
It allows simplified jq-like querying of JSON data using dot notation and minimal syntax.

๐Ÿ”ง Features

๐Ÿ›  Installation

perl Makefile.PL
make
make test
make install

๐Ÿš€ Usage

As a Perl module

use JQ::Lite;

my $json = '{"users":[{"name":"Alice"},{"name":"Bob"}]}';
my $jq = JQ::Lite->new;
my @names = $jq->run_query($json, '.users[] | .name');

print join("\n", @names), "\n";

As a CLI tool

cat users.json | script/jq '.users[] | .name'

Or create a symlink or copy to use as jq:

ln -s script/jq ~/bin/jq
chmod +x ~/bin/jq

๐Ÿ“˜ Example Input

{
  "users": [
    { "name": "Alice", "age": 30 },
    { "name": "Bob", "age": 25 }
  ]
}

Example Queries

cat users.json | jq '.users[] | .name'
cat users.json | jq '.users | length'
cat users.json | jq '.users[0] | keys'
cat users.json | jq '.users[].nickname?'
cat users.json | jq '.users[] | select(.age > 25)'
cat users.json | jq -r '.users[].name'

๐Ÿงช Testing

prove -l t/

๐Ÿ“ฆ CPAN

This module is available on CPAN: JQ::Lite

๐Ÿ“ License

This module is released under the same terms as Perl itself.

๐Ÿ‘ค Author

Kawamura Shingo
pannakoota1@gmail.com

GitHub: https://github.com/kawamurashingo/JQ-Lite