title: Parsing continuous JSON stream in iOS
body: <p>I'm struggling to get a hang of JSON for an app I'm writing. On the app side I have a NSInputStream that is connected to a server with CFStreamCreatePairWithSocketToHost.</p>
  
  <p>The server is generating JSON objects in an async fashion to the app.</p>
  
  <p>In the app I react to network data on the event NSStreamEventHasBytesAvailable. On some networks I experience that I receive multiple JSON objects in the network buffer. But I also want to be take care of the scenario where I do not receive the entire JSON object in one network buffer.</p>
  
  <p>I've been looking for a JSON parser that will handle these scenarios for me, but haven't been able to find one. NSJSONSerialization doesn't cope well with multiple JSON objects in the NSData it is to pass. I can't get the hang of how to get NSJSONSerialization working on a stream and am unsure it that will solve my problem.</p>
  
  <p>I've looked into YAJL but I can only get it to work more than once. I can't seem to find any good examples for the scenario I have.</p>
  
  <p>I'm frustrated and confused what is the best approach and where I find a good example? Any suggestions are welcome!</p>