Document `fromstream` best practices
Author: myaaaaaaaaaCreated Feb 16, 2026Updated Sep 6, 2026
fromstream's behavior is generally confusing, see the below issues:
- #1957
- #2464
- #3037
It seems like this filter requires end-of-object markers. How well-supported is the [[null]] trick? It would be nice if it were documented somewhere.
Alternatively, it would be nice to have a more intuitive filter that collects a stream into a single object. This way, it doesn't require end-of-object markers, so it never produces empty results.
def collectstream(f):
fromstream(
(f | select(length == 2)),
[[null]]
);Source: jqlang/jq