title: Google BigQuery and JSON output format for String vs. Integer
body: <p>It appears that BigQuery always puts double quotes around values when selecting --format json even when the field is an integer field</p>
  
  <p>If you run this:</p>
  
  <pre><code>node --eval 'console.log(JSON.stringify({a:1}));'
  </code></pre>
  
  <p>you'll see the string:</p>
  
  <pre><code>{"a":1}
  </code></pre>
  
  <p>(1 is an <code>integer</code> and it is displayed as an integer in the javascript object.)</p>
  
  <p>We'd like the output of a query in BigQuery to be also </p>
  
  <pre><code>{"a":1}
  </code></pre>
  
  <p>when the field is an <code>integer</code> field</p>
  
  <p>For example, with a "bqtest" file that contains:</p>
  
  <pre><code>a
  1
  </code></pre>
  
  <p>do the following:</p>
  
  <pre><code>bq load --skip_leading_rows 1 --replace --project_id YOUR-PROJECT-ID nfl.jsontestinteger bqtest  a:integer
  </code></pre>
  
  <p>then</p>
  
  <pre><code>bq query --format json --project_id YOUR-PROJECT-ID "SELECT * FROM nfl.jsontestinteger"
  </code></pre>
  
  <p>You will see:</p>
  
  <pre><code>[{"a":"1"}]
  </code></pre>
  
  <p>Here's public table that you can use if you don't wish to create one:</p>
  
  <pre><code>bq query --format json --project_id YOUR-PROJECT-ID "SELECT * FROM [personal-real-estate:nfl.jsontestinteger]"
  </code></pre>
  
  <p>Question: Is there any way to get BigQuery to format <code>integers</code> without double quotes in json format output?</p>
  
  <p>Just to confirm here's the same flow but we create the field as a <code>string</code> field</p>
  
  <pre><code>bq load --skip_leading_rows 1 --replace --project_id YOUR-PROJECT-ID nfl.jsonteststring bqtest  a:string
  
  bq query --format json --project_id YOUR-PROJECT-ID "SELECT * FROM [personal-real-estate:nfl.jsonteststring]"
  </code></pre>
  
  <p>Also returns the EXACT same result:</p>
  
  <pre><code>[{"a":"1"}]
  </code></pre>
  
  <p>Should not the output be different for <code>string</code> and <code>integer</code> fields?</p>