title: Adding Unformatted JSON text to ACE Editor Div with JQuery
body: <p>I have an instance of an ACE editor within my webpage, and I want to be able to populate it from a text file. To do so, I have set up a dropdown whose onchange function maps to the following:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      function popEx(example){
          $.getJSON('testing.txt', function(data){
              var curr_row = $(example).closest('tr');
              var elem = $(curr_row.children()[1]).children()[0];
              var editor = ace.edit(elem);
  
              editor.getSession().setValue(JSON.parse(data));
              //editor.getSession().setValue(JSON.stringify(data));
          });
      }
   &lt;/script&gt;
  </code></pre>
  
  <p>The issue I'm coming across is automatically formatting the text as JSON. The commented out stringify will paste it just fine, but I'd like it to auto format for me in indented JSON style. Currently the page breaks and gives the error <code>SyntaxError: JSON.parse: unexpected character at line 1 column 2 of the JSON data</code>. I'm sure there's an easy way to do this, does anyone have a quick solution?</p>