title: Process large JSON stream with jq
body: <p>I get a very large JSON stream (several GB) from <code>curl</code> and try to process it with <code>jq</code>.</p>
  
  <p>The relevant output I want to parse with <code>jq</code> is packed in a document representing the result structure:</p>
  
  <pre><code>{
    "results":[
      {
        "columns": ["n"],
  
        // get this
        "data": [    
          {"row": [{"key1": "row1", "key2": "row1"}], "meta": [{"key": "value"}]},
          {"row": [{"key1": "row2", "key2": "row2"}], "meta": [{"key": "value"}]}
        //  ... millions of rows      
  
        ]
      }
    ],
    "errors": []
  }
  </code></pre>
  
  <p>I want to extract the <code>row</code> data with <code>jq</code>. This is simple:</p>
  
  <pre><code>curl XYZ | jq -r -c '.results[0].data[0].row[]'
  </code></pre>
  
  <p>Result:</p>
  
  <pre><code>{"key1": "row1", "key2": "row1"}
  {"key1": "row2", "key2": "row2"}
  </code></pre>
  
  <p>However, this always waits until <code>curl</code> is completed.</p>
  
  <p>I played with the <code>--stream</code> option which is made for dealing with this. I tried the following command but is also waits until the full object is returned from <code>curl</code>:</p>
  
  <pre><code>curl XYZ | jq -n --stream 'fromstream(1|truncate_stream(inputs)) | .[].data[].row[]'
  </code></pre>
  
  <p>Is there a way to 'jump' to the <code>data</code> field and start parsing <code>row</code> one by one without waiting for closing tags?</p>