| Basic Filters | |||
. | Identity | ||
.foo | Get field | ||
.foo.bar | Nested access | ||
.[0] | Array index | ||
.[] | Iterate elements | ||
.[]? | Iterate, suppress errors | ||
.[2:4] | Array slice | ||
| , | Pipe, multiple outputs | ||
. as $x | Variable binding | ||
| Types & Values | |||
[...] | Construct array | ||
{foo, bar} | Construct object | ||
.. | Recursive descent | ||
type | Type of value | ||
null | Null value | ||
| Operators | |||
+ | Add/concat/merge | ||
- | Subtract/array diff | ||
* | Multiply | ||
/ | Divide/split string | ||
% | Modulo | ||
// | Fallback alternative | ||
| Conditionals & Logic | |||
if-then-else | Conditional | ||
== != | Equality | ||
< <= > >= | Comparison | ||
and or not | Boolean logic | ||
try-catch | Error handling | ||
? | Suppress errors | ||
| Transformations | |||
map(f) | Transform array | ||
map_values(f) | Transform object values | ||
select(cond) | Filter elements | ||
del(.foo) | Delete key/path | ||
to_entries | Object to key-value array | ||
from_entries | Key-value array to object | ||
paths | All paths in value | ||
pick(.a, .b) | Select paths | ||
| Arrays | |||
sort | Sort ascending | ||
sort_by(.x) | Sort by field | ||
unique | Deduplicate | ||
group_by(.x) | Group by field | ||
reverse | Reverse array | ||
min / max | Min/max element | ||
first / last | First/last element | ||
nth(n) | Nth element | ||
contains(x) | Contains element | ||
indices(x) | All indices of x | ||
| Strings | |||
split(sep) | Split string | ||
join(", ") | Join array to string | ||
ascii_downcase | Lowercase ASCII | ||
ascii_upcase | Uppercase ASCII | ||
ltrimstr | Trim prefix | ||
rtrimstr | Trim suffix | ||
startswith | Has prefix | ||
endswith | Has suffix | ||
"\(exp)" | String interpolation | ||
test("^a") | Regex match | ||
| Functions | |||
length | Length/size | ||
keys | Object keys as array | ||
has(key) | Key/index exists | ||
in(obj) | Key in object | ||
add | Sum/concat all | ||
any / all | Any/all true | ||
flatten | Flatten nested arrays | ||
range(3) | Numeric range | ||
| Advanced | |||
reduce .[] as $x (0; .+$x) | Fold/reduce | ||
recurse(f) | Recursive apply | ||
walk(f) | Recursive transform | ||
while(cond; f) | Loop while true | ||
until(cond; f) | Loop until true | ||
$ENV | Environment vars | ||
now | Unix timestamp | ||
tojson | To JSON string | ||
fromjson | Parse JSON string | ||
@base64 | Base64 encode | ||
@uri | URI encode | ||