0

I get back a json of structure like

{ ResultCount =7; ResultLimit=30; ResultList=({ AlbumId=111;ArtistId=203},{AlbumId=112;ArtistId=203}); Status=0}

The ResultList is an array. How can I get the AlbumId and ArtistId in an NSArray?

4 Answers 4

2

Hi happy_iphone_developer,

ResultList is not a Array and it's NSDictionary.

 NSString *urlDataString = [[NSString alloc] initWithData:RecievedData encoding:NSUTF8StringEncoding];

parser = [[SBJSON alloc] init]; 

NSError *error = nil;

 NSArray *resultArray = [parser objectWithString:urlDataString error:&error];

NSString *extractString = [[resultArray valueForKey:@"ResultList"] valueForKey:@"AlbumId"];

Whatever you want to extract, use this way to extract the particular data.

Thanks.

Sign up to request clarification or add additional context in comments.

Comments

1

are you wanting to make good json ? then,

{ ResultCount:7, ResultLimit:30, ResultList:[{ AlbumId:111,ArtistId:203},{AlbumId:112,ArtistId:203}]}

or you want to parse in iPhone then

http://code.google.com/p/json-framework

is good framework

Comments

0

Just use a JSON framework like this and you're set.

Comments

0

The ResultList is not a NSArray, it's a NSDictionnary.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.