title: Replace character in pig
body: <p>My data is in the following format..</p>
  
  <pre><code>{"Foo":"ABC","Bar":"20090101100000","Quux":"{\"QuuxId\":1234,\"QuuxName\":\"Sam\"}"}
  </code></pre>
  
  <p>I need it to be in this format:</p>
  
  <pre><code>{"Foo":"ABC","Bar":"20090101100000","Quux":{"QuuxId":1234,"QuuxName":"Sam"}}
  </code></pre>
  
  <p>I'm trying to using Pig's replace function to get it in the format I need..
  So, I tried ..</p>
  
  <pre><code>"LOGS = LOAD 'inputloc' USING TextStorage() as unparsedString:chararray;;" +
  "REPL1 = foreach LOGS REPLACE($0, '"{', '{');" +
  "REPL2 = foreach REPL1 REPLACE($0, '}"', '}');"
  "STORE REPL2 INTO 'outputlocation';"
  </code></pre>
  
  <p>It throws an error.. Unexpected token '{' in expression or statement.</p>
  
  <p>So based on an answer <a href="https://stackoverflow.com/questions/23774447/pig-script-replace-with-pipe-symbol">here</a>, I tried:</p>
  
  <pre><code>"REPL1 = foreach LOGS REPLACE($0, '"\\{', '\\{');"
  </code></pre>
  
  <p>Now, it gives an error.. Unexpected token '\\' in expression or statement.</p>
  
  <p>Any help is sincerely appreciated..</p>
  
  <p>Thanks</p>