Skip to main content
Every TalkValue CLI command supports --json (or auto-emits JSON when piped). jq is the standard tool for slicing that JSON into the exact shape you need: a single field, a count, a CSV, a chart-ready projection. The snippets below cover the patterns that keep showing up in real scripts.
Prerequisites: authenticated CLI and jq installed. On macOS, brew install jq. On Debian/Ubuntu, sudo apt install jq. On Windows, winget install jqlang.jq.

The envelope

Every list command returns this shape:
Every single-resource command returns:
Errors land on stderr as:
Almost every snippet below opens with .data or .data[].

Project: pick specific fields

Returns one object per person with only the three fields. The same pattern works on any list:

Extract a single field as a flat list

-r (raw output) strips JSON quotes so you get one email per line. Ready to pipe into mail, wc -l, or a follow-up CLI call.

Filter: keep rows that match

Wrap the pipeline in [ ... ] to collect the matches into an array. Drop the brackets for a stream of unwrapped objects.

Count

length on an array returns its size. pagination.totalElements returns the server-side total without pulling every page.

Group and count by company

The // "Unknown" fallback keeps people without a company in the group instead of producing a null bucket.

Project to CSV

@csv quotes fields, escapes commas, and produces a valid CSV file. The first line is the header, the rest are rows.

Walk every page

jq -e exits non-zero when the test is false, so the loop stops the first time a page returns no rows. Streaming .data[] keeps every record on stdout for further piping.

Combine: count by company across all pages

The page-walk streams every record. jq -s (slurp) collects them back into a single array for the group-and-count step.

Read the error envelope

Captures stderr separately from stdout so you get both the exit code (see Exit codes) and the structured error message in one place.

Tips

  • Quote your jq filter in single quotes so the shell doesn’t expand $ characters before jq sees them.
  • Pass dynamic values with --arg name value (string) or --argjson name value (parsed JSON). Inside the filter, reference them as $name.
  • Pretty-printed JSON is the default. Pass -c for one-record-per-line output that streams cleanly into other tools.
  • jq has a built-in now function. now | strftime("%Y-%m-%d") makes timestamped filenames trivial.

See also