title: Hive: parsing JSON
body: <p>I am trying to get some values out of nested JSON for millions of rows (5 TB+ table). What is the most efficient way to do this?</p>
  
  <p>Here is an example:</p>
  
  <pre><code>{"country":"US","page":227,"data":{"ad":{"impressions":{"s":10,"o":10}}}}
  </code></pre>
  
  <p>I need these values out of the above JSON:</p>
  
  <pre><code>Country        Page      impressions_s       impressions_o
  ---------      -----     -------------       --------------
  US              2        10                  10
  </code></pre>
  
  <p>This is Hive's json_tuple function, I am not sure if this is the best function.
  <a href="https://cwiki.apache.org/confluence/display/Hive/LanguageManual+UDF#LanguageManualUDF-getjsonobject" rel="noreferrer">https://cwiki.apache.org/confluence/display/Hive/LanguageManual+UDF#LanguageManualUDF-getjsonobject</a></p>