Skip to main content

JQ Queries

JQ Query-Based Field Extraction

Georg Olafsson avatar
Written by Georg Olafsson
Updated this week

With jq Query‑Based Field Extraction, you can create custom response values for any integration endpoint. Extract, transform, or compute specific fields from JSON response, without changing the integration itself.

What you can do

  • Define values using jq queries

  • Compute derived values at runtime

  • Array filtering, nested selection, aggregations, conditionals

  • Works at the root level and within array templates

AI‑Assisted Query Generation

Describe what you want to extract in plain language; the assistant produces a valid jq query with real‑time validation.

  • Natural language → jq

  • Real‑time preview of results

  • Auto‑retry (3 attempts) with error context for self-correction

  • Automatic type suggestions (string, array, number)

How to Use It

  1. Open your integration endpoint

  2. Scroll to Response values and click Add custom value.

  3. Enter a label and choose the field type.

  4. Use AI Prompt to auto‑generate a query and make sure the Query result at the bottom shows a valid response.

  5. (Optional) You can also write JQ code directly to the JQ Query field.

  6. Save.

Real‑World Examples

1) Signet Document Signing

Scenario: The Signet response returns multiple document IDs (an array); but you only need the first one.

JSON response:

{
"DocIDs": [
"703768ad-26ca-42e5-8767-cb416bf30b2a"
],
"GroupID": "cb1a21fd-34f7-48a3-836b-d2904fc96f62"
}
JQ code:
.DocIDs[0]
Signet Example

2) HRIS / Payroll

Scenario: Extract the email of the primary employee.

JSON response:

{
"employees": [
{ "name": "Anna", "type": "primary", "email": "anna@company.com" },
{ "name": "John", "type": "secondary", "email": "john@company.com" }
]
}
JQ code:
.employees[] | select(.type == "primary") | .email
Result:
"anna@company.com

3) CRM (HubSpot / Pipedrive)

Scenario: Sum the value of all open deals.

JSON response:

{
"deals": [
{ "status": "open", "total": 1500 },
{ "status": "closed", "total": 2000 },
{ "status": "open", "total": 500 }
]
}
JQ code:

.deals | map(select(.status == "open") | .total) | add
Result:
2000

4) Conditional Fallback

Scenario: Read email from either user or contact.

JSON response:

{
"user": { "email": null },
"contact": { "email": "backup@example.com" }
}

JQ code:
.user.email // .contact.email

Result:
backup@example.com

Use Cases at a Glance

Use Case

jq Query

Description

Get first item

.items[0]

Extracts the first array element

Filter by condition

.users[] | select(.active == true)

Returns only active users

Sum totals

.orders | map(.total) | add

Aggregates numeric fields

Nested value

.data.payload.email

Access deeply nested fields

Conditional fallback

.primary.email // .backup.email

Uses backup when primary is missing

Tips & Best Practices

  • Use the preview to validate your jq query before saving.

  • jq is case‑sensitive.

  • Use // for fallback values.

  • When aggregating, ensure values are numeric (e.g., via map(.field)).

Did this answer your question?