title: Converting data from multiple Hive Tables to Complex JSON
body: <p>I have data across two hive tables that I need to join and generate a JSON Object. I found few libraries (BrickHouse, OpenX) to have hive table map to a complex JSON schema. However, I am not able to find a way to get the results from the two tables into this Hive table.</p>
  
  <p>E.g:</p>
  
  <blockquote>
    <p>Table-A </p>
    
    <p>Col1          Col2 </p>
    
    <p>"userLogins"     30</p>
    
    <p>Table B</p>
    
    <p>Col1           Col2            Col3</p>
    
    <p>"userLogins"    "Site A"        10 </p>
    
    <p>"userLogins"    "Site B"        20</p>
    
    <p>I want to generate a JSON Object such as : </p>
    
    <p>{   name: "userLogins",</p>
    
    <p>children: [{name: "Site A", logins:10}, {name: "Site B", logins:20}]
    }</p>
  </blockquote>
  
  <p>I have tried finding any clues to a possible solution but most links online are about converting JSON to Hive Table and not vice versa. Is there a better/easier way to achieve this ? </p>