Skip to main content
Version: 1.0.0

Query structure

Every JQL query says what result you want and which JSON file contains the data.

Every query needs select and from:

select {fields} from 'file.json'

For example:

jql "select {name, email} from 'customers.json'"

Main clauses

ClauseWhat it does
selectDescribes the fields and shape of the result.
fromChooses the JSON file.
joinCombines related records from another file.
whereKeeps records that match a condition.
group byCreates groups for summaries.
havingKeeps groups that match a condition.
sortOrders the final array by output fields.

The remaining clauses are optional.

A complete query

select {region, revenue: sum(amount)}
from 'orders.json'
where status = 'paid'
group by region
having revenue >= 100
sort !revenue

JQL reads this query in a predictable order:

  1. Read orders.json.
  2. Keep paid orders.
  3. Group them by region.
  4. Calculate revenue for every region.
  5. Keep regions whose revenue is at least 100.
  6. Sort the resulting regions by revenue.

Object and summary results

Braces create one object for every matching record:

select {id, name} from 'customers.json'

A named function list without braces creates one summary object:

select customers: count(id) from 'customers.json'

Keywords

Keywords and function names are case-insensitive, but JQL documentation uses lowercase as the conventional style. Field names and string values keep their original case. Unicode field names are supported.

JQL also accepts where before from:

select {id} where active = true from 'customers.json'

The usual from ... where ... order is easier to read and is used throughout this documentation.