LinuxCommandLibrary

jtbl

Display jump tables from ELF files

TLDR

Print a table from JSON or JSON Lines input

$ cat [file.json] | jtbl
copy

Print a table and specify the column width for wrapping
$ cat [file.json] | jtbl --cols=[width]
copy

Print a table and truncate rows instead of wrapping
$ cat [file.json] | jtbl [[-t|--truncate]]
copy

Print a table and don't wrap or truncate rows
$ cat [file.json] | jtbl [[-n|--no-wrap]]
copy

SYNOPSIS

jtbl [-CdfnNho] [-w WIDTH] [-F FORMAT] [-H HEADER] [-c COL] [-k KEY] [FILE...]

PARAMETERS

-C
    enable color output

-c COL
    select columns by name or index (comma-separated)

-d DELIM
    field delimiter (default: tab)

-f
    read JSON from files, not stdin

-F FORMAT
    output format: plain, html, md, csv, tsv (default: plain)

-H HEADER
    use first row as header

-h
    show help

-k KEY
    sort by key

-n
    no headers

-N
    no truncate columns

-o
    one line per object (no table)

-w WIDTH
    maximum table width

DESCRIPTION

jtbl is a command-line utility that reads JSON data from standard input or files, expecting an array of objects, and renders it as a human-readable table.

It automatically detects column widths, aligns data, and supports multiple output formats including plain text, HTML, Markdown, CSV, and TSV.

Ideal for processing JSON output from tools like jq, APIs, or scripts, jtbl simplifies viewing structured data without manual formatting. It handles headers, sorting keys, and custom column selection.

Written in C for efficiency, it pipes seamlessly in workflows: jq '.data[]' api.json | jtbl.

Key strengths: fixed-width columns, color output, no dependencies beyond libc.

CAVEATS

Input must be valid JSON array of objects; malformed JSON causes errors.
Fixed-width assumes terminal; HTML/MD ignores width.
Not installed by default; install via source or packages (e.g., FreeBSD ports).

EXAMPLE USAGE

curl -s api.example.com/data | jq '.["items"]' | jtbl -CH
Outputs colorized HTML table with headers.

INPUT REQUIREMENTS

Expects [ {"col1":"val", "col2":123}, ... ]
Single objects auto-wrapped in array.

HISTORY

Developed by Jan-Piet Mens (jpmens.net) around 2015 as part of JSON tooling suite alongside jo (JSON builder).
First release v1.0 in 2016; actively maintained with format expansions.
Popular in Unix-like systems for jq pipelines.

SEE ALSO

jq(1), jo(1), column(1), tsv2table(1)

Copied to clipboard