Search notes:

jq --arg

jq --arg nam val assigns the value val to the variable nam. The variable can then be referred to in the jq program as $nam.
The arguments passed with --arg are interpreted as strings:
$ jq  --arg num1 40 --arg num2 2 -n '$num1 + $num2'
"402"
In order to convert them to a number the tonumber operator can be used:
$ jq --arg num1 40 --arg num2 2 -n '($num1 | tonumber) + ($num2 | tonumber)'

Index