LinuxCommandLibrary

jql

Query JSON data using a SQL-like language

SYNOPSIS

jql [OPTIONS] <QUERY> [FILES...]

PARAMETERS

-c, --compact-output
    Compact JSON output (one object per line)

-h, --help
    Print help information

-i, --indent <INDENT>
    Pretty print JSON with indentation (default: 2)

-r, --raw-output
    Output raw strings (instead of quoted strings)

-s, --slurp
    Slurp all input files into a single array

-S, --spread
    Spread objects into individual rows

-V, --version
    Print version

--colors <WHEN>
    Control colors: never, auto, always (default: auto)

--query-timeout <DURATION>
    Timeout for query (default: 10s)

DESCRIPTION

jql is a fast, lightweight command-line tool for querying JSON data using standard SQL syntax. Designed for efficiency on large files, it processes data in a streaming fashion without loading entire datasets into memory.

Key features include support for SELECT, WHERE, JOIN, GROUP BY, ORDER BY, aggregations (COUNT, SUM, AVG), and functions like JSON_EXTRACT. It handles nested JSON structures seamlessly by treating them as relational tables via virtual columns.

Unlike jq, which requires learning a custom filter language, jql offers an intuitive SQL interface ideal for users familiar with databases. Input comes from files, stdin, or multiple files slurped into arrays. Output is pretty-printed JSON by default, with options for compact, raw, or colored formats.

Perfect for log analysis, API responses, config files, and data extraction pipelines. Written in Rust for speed and safety.

CAVEATS

Not installed by default; install via cargo install jql-cli, Homebrew, or packages. SQL dialect is JSON-specific, not full SQL92. Large queries on massive files may timeout.

BASIC EXAMPLE

jql 'SELECT * FROM input LIMIT 5' data.json
Extracts first 5 rows.

FILTER EXAMPLE

jql 'SELECT name, age FROM input WHERE age > 30' users.json
Filters users over 30.

HISTORY

Developed by yamafaktory starting 2021. Written in Rust for performance. Reached v6+ by 2023 with JSONPath support, streaming improvements, and broader SQL functions.

SEE ALSO

jq(1), gron(1), jaq(1)

Copied to clipboard