Muhammad Nabeel Arif
Muhammad Nabeel Arif

Reputation: 19310

Can I get JSON response instead of xml? in ASIs3bucketRequest

I am using following code to get list of items in s3-bucket:

ASIS3BucketRequest *request = [ASIS3BucketRequest requestWithBucket:@"my-bucket"];
NSString *key = kS3SecretKey;
[request setSecretAccessKey:key];
key = kS3AccessKey;
[request setAccessKey:key];
[request setMaxResultCount:50]; // Max number of results we want
[request setDelegate:self];
[request setDidFailSelector:@selector(requestContentListFromBuckeFailed:)];
[request setDidFinishSelector:@selector(requestContentListFromBuckeSuccessfull:)];
[request startAsynchronous];

When I receive the respose and log it. It is in the form of xml

-(void) requestContentListFromBuckeSuccessfull: (id) request
{
    NSString *response = [[NSString alloc] initWithData:[request responseData] encoding:NSUTF8StringEncoding];
    NSLog(@"response=%@",response);

}

My question is can I set the request to receive JSON response?

Upvotes: 2

Views: 1040

Answers (1)

Sohail Mohabbat Ali
Sohail Mohabbat Ali

Reputation: 382

No

You cannot get s3 response in json. Amazon S3 do not support json response. For this purpose you have to use xml parser in your objective C code.

Upvotes: 1

Related Questions