title: objective c parse json from url request
body: <p>I am trying to parse a json string requested from an api located at:
  <a href="http://www.physics.leidenuniv.nl/json/news.php" rel="noreferrer">http://www.physics.leidenuniv.nl/json/news.php</a></p>
  
  <p>However, i am having trouble parsing this json.
  I get the following error:
  <code>Unexpected end of file during string parse</code></p>
  
  <p>I have looked for hours, but I can not find an answer to this problem.</p>
  
  <p>My code snippet:</p>
  
  <p>In my viewDidLoad:</p>
  
  <pre><code>NSURLRequest *request = [NSURLRequest requestWithURL:
                           [NSURL URLWithString:@"http://www.physics.leidenuniv.nl/json/news.php"]];
  
  [[NSURLConnection alloc] initWithRequest:request delegate:self];
  </code></pre>
  
  <p>The delegate:</p>
  
  <pre><code>- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data {
  NSMutableData *responseData = [[NSMutableData alloc] init];
  [responseData appendData:data];
  
  NSString *responseString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
  NSError *e = nil;
  NSData *jsonData = [responseString dataUsingEncoding:NSUTF8StringEncoding];
  NSDictionary *JSON = [NSJSONSerialization JSONObjectWithData:jsonData options: NSJSONReadingMutableContainers error: &amp;e];
  }
  </code></pre>
  
  <p>Anybody know an answer to this problem so i can parse the json data?</p>