title: hive explode list from json-string
body: <p>I have table with jsons:</p>
  
  <pre><code>CREATE TABLE TABLE_JSON (
    json_body string
   );
  </code></pre>
  
  <p>Json has structure:</p>
  
  <pre><code>{ obj1: { fields ... },  obj2: [array] }
  </code></pre>
  
  <p>I want to select all elements from array, but I can't.</p>
  
  <p>For example, I can get all fields from first object:</p>
  
  <pre><code>SELECT f.fields...
      FROM (
          SELECT q1.obj1, q1.obj2
          FROM TABLE_JSON jt
          LATERAL VIEW JSON_TUPLE(jt.json_body, 'obj1', 'obj2') q1 AS obj1, obj2
        ) as json_table2
      LATERAL VIEW JSON_TUPLE(TABLE_JSON.obj1, 'fields...') f AS fields...;
  </code></pre>
  
  <p>But with array this method doesnt work.</p>
  
  <p>I've tried to use </p>
  
  <pre><code>...
      LATERAL VIEW explode(json_table2.obj2) adTable AS arr;
  </code></pre>
  
  <p><a href="https://cwiki.apache.org/confluence/display/Hive/LanguageManual+LateralView" rel="nofollow">hive explode doc</a></p>
  
  <p>But obj2 - string with array. How to transform string-json to array and explode it?</p>