- length
- Length of a string, array, or object (number of keys).
- keys
- Array of an object's keys, sorted.
- values
- Array of an object's values.
- has("foo")
- Returns true if the object has key foo.
- in({"a":1})
- Returns true if the input key exists in the object.
- map(.x)
- Apply a filter to every element of an array.
- map_values(.x + 1)
- Apply a filter to every value of an object.
- select(.age > 18)
- Filter — emits the input only if the condition is true.
- empty
- Produces no output (useful to discard values).
- add
- Sum an array of numbers, or concatenate strings/arrays.
- any
- True if any element satisfies the condition.
- all
- True if all elements satisfy the condition.
- flatten
- Flatten nested arrays into a single array.
- unique
- Remove duplicate values from an array.
- unique_by(.x)
- Remove duplicates based on a key expression.
- group_by(.x)
- Group array elements by a key expression.
- sort_by(.x)
- Sort an array by a key expression.
- min_by(.x) / max_by(.x)
- Minimum / maximum element by key.
- to_entries
- Convert object to [{key, value}] array.
- from_entries
- Convert [{key, value}] array back to an object.
- with_entries(.value += 1)
- Shorthand for to_entries | map(…) | from_entries.
- type
- Returns the type string: "null", "boolean", "number", "string", "array", "object".
- strings / numbers / arrays / objects / booleans / nulls
- Select only values of that type.
- tostring / tonumber
- Convert between strings and numbers.
- ascii_downcase / ascii_upcase
- Change string case.
- ltrimstr(s) / rtrimstr(s)
- Strip a prefix / suffix from a string.
- split(",") / join(",")
- Split a string into an array, or join an array into a string.
- test("regex")
- Test a string against a regular expression.
- capture("(?:\\d{4})")
- Extract named capture groups from a string as an object.
- env
- Access environment variables as an object.
- path(.foo.bar)
- Returns the path expression as an array of keys.
- getpath(["a","b"])
- Get a value at an array path.
- setpath(["a","b"]; 1)
- Set a value at an array path.
- delpaths([["a"]])
- Delete values at the given paths.
- del(.foo)
- Delete a key from an object or element from an array.
- recurse
- Recursively descend through nested structures.
- walk(f)
- Apply f to every node bottom-up in a JSON document.
- tojson / fromjson
- Encode to / decode from a JSON string.
- error(msg)
- Throw an error with a message.
- debug
- Print the value to stderr and pass it through unchanged.
- limit(n; expr)
- Emit at most n outputs from expr.
- first(expr) / last(expr)
- Emit only the first or last output of expr.
- range(n) / range(from; to)
- Emit integers 0..n-1 or from..to-1.
- indices(s)
- Find all positions of a substring or element.
- index(s) / rindex(s)
- First / last position of a substring or element.
- inside(b)
- Returns true if the input is contained within b.
- contains(b)
- Returns true if b is contained within the input.