title: How to create nested JSON format table from flat table in BigQuery?
body: <p>I have a wide flat table, stored in Google bigquery in the folowing similar format : </p>
  
  <blockquote>
    <p>log_date:integer,sessionid:integer,computer:string,ip:string,event_id:integer,amount:float</p>
  </blockquote>
  
  <p>I'm trying to create this table in hierarchical nested format  , having 2 nested levels  , as following : </p>
  
  <pre><code> [
    {
      "name": "log_date",
      "type": "integer"
    }, 
    {
      "name": "session",
      "type": "record",
      "mode": "repeated",
      "fields": [                 
       {
         "name": "sessionid",
         "type": "integer"
           },
       {
         "name": "computer",
         "type": "string"
          },
          {
         "name": "ip",
         "type": "string"
          },
          {
      "name": "event",
      "type": "record",
      "mode": "repeated",
      "fields": [
      {
         "name": "event_id",
         "type": "integer"
       },
       {
         "name": "amount",
         "type": "float"
       }]] } ]
  </code></pre>
  
  <p>What is the best way to generate the json formatted data file from bigquery table ?
  Is there a different and faster approach than 
  1. download the table into external csv
  2. build the json record , and write it into external file 
  3. upload the external json file into new bigquery table </p>
  
  <p>Can we have a direct process that generates json from existing tables ? </p>
  
  <p>Thank you , H  </p>