How to limit results across multiple JSON documents, without reading every document? #3436
Answered
by
wader
VictorEngmarkHexagon
asked this question in
Q&A
-
|
I'm trying to get the first handful of results of an expression across multiple JSON documents output by an API. That is, the API prints a full JSON document for each response, and I want to run a query which stops after To put this in more concrete terms, I'm trying to get only the first 10 jobs from What I've tried so far:
|
Beta Was this translation helpful? Give feedback.
Answered by
wader
Nov 17, 2025
Replies: 1 comment
-
|
Maybe something like this? # select the 3 first even numbers
$ echo 1 2 3 4 5 6 7 8 | jq -n 'limit(3; inputs | select(. % 2 == 0))'
2
4
6 |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
VictorEngmarkHexagon
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Maybe something like this?