NAME

jq-lite - minimal jq-style JSON filter (pure Perl)

SYNOPSIS

jq-lite [options] filter [file ...]

cat users.json | jq-lite '.users[].name'
jq-lite '.items | sort | first' data.json
jq-lite -R -s -c 'split("\n")' logfile.txt

DESCRIPTION

jq-lite is a jq-compatible JSON processor written entirely in pure Perl.

It is intended for use on systems where jq is unavailable but Perl is present, providing awk/sed-like convenience for processing JSON and YAML data.

Features include:

  • jq-style filters: dot traversal, pipes, basic selectors, and commonly used built-in functions

  • Command-line options such as -R, -r, -c, -a, --color, --use, --debug, -e, --slurp, --null-input, -s, --from-file, --arg, --argfile, --argjson, --rawfile, --slurpfile, --help-functions, -h, and -v

  • Pure Perl implementation with no XS, no external binaries, and no runtime dependencies beyond core modules

jq-lite aims to be compatible with jq where practical, but does not implement all jq features.

It is not a drop-in replacement for jq, but a pragmatic alternative for constrained or minimal environments.

In particular, some advanced expressions and comparisons may behave differently from jq.

OPTIONS

-R, --raw-input

Read input as raw text instead of JSON, running the filter once per line. Use -s with -R to process the entire input as a single string.

-r, --raw-output

Print raw strings instead of JSON-encoded values.

-c, --compact-output

Emit JSON on a single line without pretty-printing whitespace.

-a, --ascii-output

Escape all non-ASCII characters in JSON output.

--color

Colorize JSON output (keys, strings, numbers, booleans).

--use Module

Force the JSON decoder module (for example JSON::PP, JSON::XS, or Cpanel::JSON::XS).

--debug

Show which JSON module is being used.

-e, --exit-status

Set exit code to 1 when the final result is false, null, or empty.

--arg name value

Define a string variable.

--rawfile name file

Read file as raw text and bind it to the variable.

--slurpfile name file

Read file as JSON and bind it to the variable as an array of values.

--argjson name value

Define a JSON variable.

--argfile name file

Read file as JSON and bind it to the variable.

-f, --from-file file

Read the jq filter from file instead of the command line (use - for STDIN).

-n, --null-input

Use null as input instead of reading JSON data.

-s, --slurp

Read the entire input stream as an array of JSON values.

--yaml

Parse input as YAML (auto-detected for .yml / .yaml files).

-h, --help

Display help and exit.

--help-functions

Show the list of supported built-in functions.

-v, --version

Display version information.

SEE ALSO

JQ::Lite, jq(1), awk(1), sed(1), perl(1)

HOMEPAGE

https://kawamurashingo.github.io/JQ-Lite/

AUTHOR

川村慎吾 (Shingo Kawamura)

COPYRIGHT AND LICENSE

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

DISCLAIMER

jq-lite is provided "as is", without warranty of any kind.