title: Reading json files in pig
body: <p>I have three data types...</p>
  
  <p>1) Base data
  2) data_dict_1
  3) data_dict_2</p>
  
  <p>Base data is very well formatted json.. 
  For example:</p>
  
  <pre><code>{"id1":"foo", "id2":"bar" ,type:"type1"}
  {"id1":"foo", "id2":"bar" ,type:"type2"}
  </code></pre>
  
  <p>data_dict_1</p>
  
  <pre><code>1 foo
  2 bar
  3 foobar
  ....
  </code></pre>
  
  <p>data_dict_2</p>
  
  <pre><code>-1 foo
  -2 bar
  -3 foobar
  ... and so on
  </code></pre>
  
  <p>Now, what I want is.. if the data is of type1</p>
  
  <p>Then read id1 from data_dict_1, id2 from data_dict2 and assign that integer id..
  If data is of type2.. then read id1 from data_dict_2.. id2 from data_dict1.. and assign corresponding ids..
  For example:</p>
  
  <pre><code>{"id1":1, "id2":2 ,type:"type1"}
  {"id1":-1, "id2":-2 ,type:"type2"}
  </code></pre>
  
  <p>And so on..
  How do i do this in pig?</p>