title: BigQuery extract table schema
body: <p>There is a huge nested (structured) table.</p>
  <p>The need:</p>
  <p>Create identical table with same schema and data on other project other region. Copying is not working as different regions.</p>
  <p>Have been trying:</p>
  <p>Export table to bucket (JSON as AVRO not allows edit schema once loading data), then extract old table schema and create a new table from bucket, providing schema. As typing schema manually is not possible because of structured table schema size and complexity.</p>
  <p>Errors get:</p>
  <p>Once creating a table, AVRO <code>auto schema detect</code> is not recognizing some data types correctly, JSON fails with multiple errors.</p>
  <p>The question:</p>
  <p>How to export table schema, ideally in JSON?
  Once I run this in CLI:</p>
  <pre><code>bq show --format=prettyjson Project1:BQDataset.Table1 | jq '.schema.fields'
  </code></pre>
  <p>I get a massive (hundreds of rows) .json which is not feasible to copy at console by simple highlighting text in CLI result list.
  <a href="https://i.stack.imgur.com/QzTvp.png" rel="nofollow noreferrer">fragment of JSON result in CLI</a></p>
  <p>Updated:
  The issue is solved and this initial approach is not correct.</p>