title: Parsing a JSON object with escaped double quote attributes in javascript
body: <p>After <a href="https://stackoverflow.com/questions/13056563/parsing-a-json-object-in-javascript">reading</a> a <a href="https://stackoverflow.com/questions/4935632/parse-json-in-javascript">number</a> of <a href="https://stackoverflow.com/questions/24559625/javascript-escape-double-quotes">questions</a> on parsing an object in javascript I'm still having issues with parsing the following query response:</p>
  
  <pre><code>{"messagesProfile": "[{\"message\": \"This is a test message\", \"sender\": \"test@test.com\", \"receiver
  \": \"test@test.com\"}, {\"message\": \"This is a second test message\", \"sender\": \"test@test.com
  \", \"receiver\": \"test@test.com\"}, {\"message\": \"This is a third test message\", \"sender\": \"test
  @test.com\", \"receiver\": \"test@test.com\"}]", "successProfileMessages": true}
  </code></pre>
  
  <p>The code that parses the above response is:</p>
  
  <pre><code>if(data.successProfileMessages === false) {
              alert("Failed to retrieve messages");
          } else {
              if(typeof data.messagesProfile != "undefined" &amp;&amp; data.messagesProfile != null &amp;&amp; data.messagesProfile.length &gt; 0) {
                  messages = messages + "&lt;tr&gt;";
                  messages = messages + "&lt;td&gt;";
                  messages = messages + "There are no messages yet!";
                  messages = messages + "&lt;/td&gt;";
                  messages = messages + "&lt;td&gt;";
              } else {
                  // Successfully retrieved messages
                  for(var i in  data) {
                      messages = messages + "&lt;tr&gt;";
                      messages = messages + "&lt;td&gt;";
                      messages = messages + data.messagesProfile.sender[i];
                      messages = messages + "&lt;/td&gt;";
                      messages = messages + "&lt;td&gt;";
                      messages = messages + data.messagesProfile.message[i];
                      messages = messages + "&lt;/td&gt;";
                      messages = messages + "&lt;/tr&gt;";
                  }
              }
          }
  </code></pre>
  
  <p>How is it possible to unescape the escaped double quotes and iterate through the JSON object's array fields?</p>
  
  <pre><code>"[{\"message\": \"This is a test message\", \"sender\": \"test@test.com\", \"receiver
  \": \"test@test.com\"}, {\"message\": \"This is a second test message\", \"sender\": \"test@test.com
  \", \"receiver\": \"test@test.com\"}, {\"message\": \"This is a third test message\", \"sender\": \"test
  @test.com\", \"receiver\": \"test@test.com\"}]"
  </code></pre>