Objective-C parse JSON objects

Using the example of my last entry NSURLConnection example I will show you how you can parse JSON into a more robust structure like a NSDictionary and then access the data. In this example I will use the public API of Github to access my own repositories there.

The code will be placed in the connectionDidFinishLoading because you need to wait to get the full response from the URI you are trying to get (more than one response can be received).


As you can read, It is a very straightforward code, first you make an Array with all the JSON, then you do a for to get in each iteration a repository of the response that you got. I use a temp variable “repository” because I prefer dictionary like structures.