From 2cac88a71253b60c6f2ee85fbece3705b83a2ff4 Mon Sep 17 00:00:00 2001 From: Victor Benarbia Date: Sun, 7 Jun 2026 21:15:11 -0500 Subject: [PATCH] docs: clarify --jq flag with examples and tutorial link Closes #5 Co-Authored-By: Claude Opus 4.7 --- README.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4052eb3..53590cf 100644 --- a/README.md +++ b/README.md @@ -106,7 +106,18 @@ serpapi login ## Global Flags - `--fields ` — Server-side field filtering (maps to SerpApi's `json_restrictor` parameter). Note: The `--fields` filter uses SerpApi's server-side field restrictor syntax—see [SerpApi docs](https://serpapi.com) for supported expressions. -- `--jq ` — Client-side jq filter applied to JSON output (same as `gh --jq`) +- `--jq ` — Client-side [jq](https://jqlang.github.io/jq/) filter applied to the JSON response, same as `gh --jq` (see the [jq tutorial](https://jqlang.github.io/jq/tutorial/) for syntax). Runs locally after the API call; the jq engine is embedded so no external `jq` install is required. Use `--fields` to shrink the payload server-side, then `--jq` to reshape it client-side. Examples: + ```bash + # Pick the first 3 organic results, keeping only title and link + serpapi search --jq '.organic_results[0:3] | [.[] | {title, link}]' engine=google q=coffee + + # Print just the link of each organic result + serpapi search --jq '.organic_results[].link' engine=google q=coffee + + # Count organic results + serpapi search --jq '.organic_results | length' engine=google q=coffee + ``` + Quote the expression with single quotes in bash/zsh to avoid shell interpretation of `$`, `|`, and `"`. - `--api-key ` — Override API key (takes priority over environment and config file) ## Configuration