IOS: ASIFormDataRequest with quotes

I need to send json to a web service that only accepts it through a POST variable.

ASIFormDataRequest insists on exiting my quotes.

any help would be appreciated

ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
NSString *body = [NSString stringWithFormat:@"{\"user\":\"username\",\"pass\":\"password\"}"];
[request setPostValue:body forKey:@"body"];
[request startSynchronous];

output: "{\"user\":\"username\",\"pass\":\"password\"}"
+5
source share
2 answers

Joseph X is right

ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
 [request appendPostData:[dataString dataUsingEncoding:NSUTF8StringEncoding]];
[request setRequestMethod:@"POST"];
[request startSynchronous];

there was a way to go.

0
source

Try converting the parameter to a JSON representation before sending it via SBJSON or any other JSON parser that you use.

0
source

All Articles