Parsing JSON in iOS the right way
remarkablepixels.squarespace.com
remarkablepixels.squarespace.com
An alternative approach is to use an incremental parser like YAJL. The application can feed chunks of the JSON document to the parser as the chunks arrive over the network. A clever application can update the UI before the entire document is received by examining the partially constructed object tree.
Anybody new to iOS needs to learn that connection:didReceiveData: is called as data is received. There's no way around that. There are two ways to deal with this. The first is to buffer the data as the author suggests. The other approach is to use an incremental parser.
The "foundCharacters" method is sometimes called multiple times before reaching the end of an element so it's best to assume you're receiving only part of the data.