Skip to main content
Version: 1.0.0

Get a quick summary

JQL can answer summary questions without writing a program.

Source JSON

sales.json:

[
{"id": 1, "amount": 40},
{"id": 2, "amount": 35},
{"id": 3, "amount": 25}
]

Query

jql "select revenue: sum(amount), orders: count(id) from 'sales.json'"

Result

{"revenue": 100, "orders": 3}

sum(amount) adds the values and count(id) counts the records. The result is one compact JSON object that is ready for a report or another command.