title: Retrieve Values using jQuery of JSON Data after JSON.stringify
body: <p>hope things are going well.</p>
  
  <p>I'm hoping to use jQuery to retrieve values from a JSON string. I'm currently using the following xmlHTTPrequest to retrieve the data and JSON.stringify the responseText.</p>
  
  <pre><code>var xhr = new XMLHttpRequest();        
    xhr.open("GET", "apiary url goes here");
    xhr.onreadystatechange = function () {
      if (this.readyState == 4) {
        alert(JSON.stringify(this.responseText));                        
        data = this.responseText;
      }
  };
  xhr.send(null);
  </code></pre>
  
  <p>It gives me a response such as this:</p>
  
  <pre><code>[{
      "id_profile": 1, 
      "name": "John"
      "id" : "894JF84JF39"
  },
  {
      "id_profile": 2, 
      "name": "Sally"
      "id" : "894JF231239"
  }]
  </code></pre>
  
  <p>I was attempting to the parse.JSON(); this data to turn it into a JSON object until I came across the following question/answer <a href="https://stackoverflow.com/questions/8524933/json-parse-unexpected-character-error">JSON.parse unexpected character error</a> . That question indicated that the data was already parsed. I was getting an error using <code>parseJSON(data)</code>. My goal is to use jQuery to retrieve values of the fields, but the value of <code>data[0]</code> returns the string character or "[" in this specific case. I also attempted to retrieve information use <code>data.id_profile</code> and <code>data[0].id_profile</code> but this came back "undefined" (obviously "[" doesn't have any properties).</p>
  
  <p>In the form that the JSON is returned as, what would be the effective method of retrieving the value of the "id_profile" key (or is even considered a key currently)? Can I apply a function to this data variable to turn it into a true JSON object notation or can I somehow use this existing format to get the values?</p>
  
  <p>Update #1</p>
  
  <p>It seems the data being returned has new line characters and white space and may be preventing preventing <code>JSON.parse();</code> or <code>parseJSON();</code> from returning anything other than Uncaught <code>SyntaxError: Unexpected string</code>. This seems in line with jquery parseJSON(); documentation. What javascript code could I use to replace the newline characters, empty space, and "\" characters?</p>
  
  <pre><code>{\n    \"id_artist\": 1, \n    \"name\": \"John\"\n    \"id\" : \"{\n    \"id_artist_profile\": 1, \n    \"public_nick_name\": \"Kayla\"\n    \"id_artist\" : \"894JF84JF39R90FM\",\n\",\n.............
  </code></pre>
  
  <p>Thanks for any help in advance!</p>