ð§Đ JQ::Lite â Lightweight jq in Pure Perl

ð Project homepage
âĻ What is JQ::Lite?
JQ::Lite is a pure-Perl JSON query engine inspired by jq.
It lets you query and transform JSON using jq-like syntax â without external binaries, native libraries, or compilation.
â Official Alpine Linux package
apk add jq-lite
JQ::Lite is designed for minimal environments such as:
- Alpine Linux
- containers & CI pipelines
- legacy / restricted / air-gapped systems
where simplicity, readability, and low dependency footprint matter.
ð Why jq-lite (in one glance)
-
ðŠķ Pure Perl â no XS, no C, no shared libraries
-
ð jq-style filters:
.users[].name,select(...),map(...) -
ðĒ Arithmetic & conditionals:
if ... then ... else ... end -
ð§ CLI tool:
jq-lite--null-input,--slurp,--from-file--yaml,--arg,--argjson,--ascii-output
-
ð 100+ built-in jq functions â see
FUNCTIONS.md -
ðŧ Interactive mode for exploring JSON
-
ð§° JSON & YAML input
-
ð Runs almost anywhere Perl runs â even legacy or air-gapped systems â see
VISION.md
⥠Quick Start (CLI)
jq-lite '.users[].name' users.json
jq-lite '.users[] | select(.age > 25)' users.json
jq-lite --yaml '.users[].name' users.yaml
Interactive exploration:
jq-lite users.json
ð§ą Environment Support
| Environment | jq | jq-lite | | -------------------- | -- | ------- | | Legacy CentOS / RHEL | â | â | | Alpine Linux | â ïļ | â | | Air-gapped systems | â | â | | No root privilege | â ïļ | â |
â
Runs on Perl âĨ 5.14
(e.g. CentOS 6, Debian 7 via perlbrew or local install)
ðĄ Why Pure Perl?
ð§Đ Portability
No compilation, no shared libraries. If Perl runs, jq-lite runs.
Perfect for:
- minimal containers
- legacy servers
- restricted or offline environments
ð§° Extensibility
Extend jq-like behavior directly in Perl.
You can integrate CPAN modules such as:
LWP(HTTP / APIs)DBI(databases)- filesystem or OS tools
ð§ą Seamless Perl Integration
use JQ::Lite;
my $jq = JQ::Lite->new;
say for $jq->run_query($json, '.users[].name');
No external command calls. No parsing of CLI output.
âïļ Lightweight Installation
- No XS / C toolchain
- No system-wide install required
- Ideal for CI/CD or user-local installs
ð Maintainability
- Faster iteration than C-based jq
- Easier debugging
- Community contributions are simpler
âïļ Installation
ð From CPAN
cpanm JQ::Lite
ð§ Alpine Linux (Official)
apk add jq-lite
ðš Homebrew (macOS)
brew tap kawamurashingo/jq-lite
brew install --HEAD jq-lite
ðģ Containers (Recommended)
Alpine-based image
FROM alpine
RUN apk add --no-cache jq-lite
jq-lite is ideal as a container-standard JSON tool:
- tiny footprint
- predictable behavior
- no native dependencies
ð§ Portable Installer (Online â Offline)
For air-gapped or offline systems:
- Download (on connected machine)
./download.sh [-v <version>] [-o /path/to/usb]
-
Transfer
JQ-Lite-<version>.tar.gz -
Install
./install.sh [-p <prefix>] [--skip-tests] JQ-Lite-<version>.tar.gz
Default:
$HOME/.local
Environment setup:
export PATH="$HOME/.local/bin:$PATH"
export PERL5LIB="$HOME/.local/lib/perl5/site_perl:$PERL5LIB"
ðŠ Windows (PowerShell)
.\install-jq-lite.ps1 [-Prefix <path>] [--SkipTests] JQ-Lite-<version>.tar.gz
Verify:
jq-lite -v
ð Example Queries
jq-lite '.users[] | select(.profile.active) | .name' users.json
jq-lite '.users | sort_by(.age) | map(.name) | join(", ")' users.json
jq-lite '.users[].nickname? // .name' users.json
ð Documentation
- ð Functions:
FUNCTIONS.md - ð§ Vision & portability:
VISION.md - ðĶ MetaCPAN: https://metacpan.org/pod/JQ::Lite
ðĪ Author
Shingo Kawamura (å·ææ åū) ð§ pannakoota1@gmail.com
ð License
Same terms as Perl itself.