Take the 2-minute tour ×

I have this JSON response string:


With this code:

- (void)connectionDidFinishLoading:(NSURLConnection *)connection 
    //Check valid signal

    connection = nil;

    //data =nil;

    NSArray *jsonArray = [responseString JSONValue];

How can I do it?

share|improve this question
It looks like you did it. What else do you need? –  Hot Licks Mar 18 '12 at 21:34
add comment

3 Answers

up vote 3 down vote accepted

This JSON should result in a Dictionary

NSDictionary *jsonDict = [responseString JSONValue];

use than

[jsonDict objectForKey:@"d"];
share|improve this answer
Hi I've added NSString *userName = [result objectForKey:@"Nombre"]; but I've got "variable is not a CFString at this time" value for userName. Do you why is it? Thanks for your help. –  roof Mar 19 '12 at 1:00
I'm sorry but, ... I dont have any JSONValue class. Can someone suggest me how to get this class? –  sensorario Dec 13 '12 at 8:29
@SimoneDemoGentili See cortez' answer. OP uses a third party tool, that isnt needed for iOS 5+. –  vikingosegundo Dec 13 '12 at 12:12
Where I can find this third party tool? –  sensorario Dec 13 '12 at 13:20
emm, in the internet? –  vikingosegundo Dec 13 '12 at 13:59
show 1 more comment

When you can afford to require iOS 5 you should try NSJSONSerialization.

Your code could look like this but I suggest reading the Docs first.

    NSArray* jsonArray = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:someError]
share|improve this answer
NSJsonSerializattion is the best and optimized solution compared to anyother framework.But here i found the pretty good solution for identifying the best among SBJson and NSJSONSerialization (Before the release of ios5.0 SBJSON is the good framework for handling Json objects). –  iDroid Mar 19 '12 at 4:25
add comment

Try using the SBJasonParser library for iOS.

You can then use this code (for all iOS versions):

SBJsonParser* parser = [[[SBJsonParser alloc] init] autorelease];
NSDictionary* myDict = [parser objectWithString: responseString];

Note: Your code above has a JSON Dictionary but you were trying to access it as an Array.

share|improve this answer
add comment

Your Answer


