title: “SyntaxError: Unexpected EOF” when evaluating JavaScript in iOS UIWebView
body: <p>I keep getting this error in JavaScript when trying to pass some JSON to a <code>UIWebView</code>:</p>
  
  <blockquote>
    <p>SyntaxError: Unexpected EOF</p>
  </blockquote>
  
  <p>There is no line number or filename available in <code>window.onerror</code> but I've already checked all referenced files, and they are fine.</p>
  
  <p>I'm using MonoTouch <a href="https://stackoverflow.com/a/5407039/458193"><code>EvaluateJavaScript</code></a> method which is equivalent to ObjC <a href="http://developer.apple.com/library/ios/documentation/uikit/reference/UIWebView_Class/Reference/Reference.html#//apple_ref/occ/instm/UIWebView/stringByEvaluatingJavaScriptFromString:" rel="noreferrer"><code>stringByEvaluatingJavaScriptFromString:</code></a>:</p>
  
  <pre><code>webView.EvaluateJavascript(
      "Viewer.init($('#page'), " + json.ToString() + ");"
  );
  </code></pre>
  
  <p>It works just fine on “simple” JSON input but breaks at larger objects.<br>
  What could go wrong?</p>