title: Export nested BigQuery data to cloud storage
body: <p>I am trying to export bigquery data to google cloud storage bucket via the API. I adapted a code snippet from here
  <a href="https://cloud.google.com/bigquery/docs/exporting-data" rel="noreferrer">https://cloud.google.com/bigquery/docs/exporting-data</a></p>
  
  <pre><code>Job job = table.extract(format, gcsUrl);
  // Wait for the job to complete
  try {
    Job completedJob = job.waitFor(WaitForOption.checkEvery(1, 
  TimeUnit.SECONDS),
        WaitForOption.timeout(3, TimeUnit.MINUTES));
    if (completedJob != null &amp;&amp; completedJob.getStatus().getError() == null) {
      // Job completed successfully
    } else {
      // Handle error case
         System.out.println(completedJob.getStatus().getError());
    }
  } catch (InterruptedException | TimeoutException e) {
    // Handle interrupted wait
  
  }
  </code></pre>
  
  <p>I have exchanged format with "JSON" since my data is nested and can't be exported to CSV and the gcsUrl with "gs://mybucket/export_*.json".
   But the error messages tells me the following problem:</p>
  
  <pre><code>transfer not working  BigQueryError{reason=invalid, location=null, message=Operation cannot be performed on a nested schema. Field: totals}
  </code></pre>
  
  <p>Any advice what to do? JSON should be able to handle a nested format...</p>