[英]NSArray object pass as postdata in ASIFormDataRequest
I need to post some data to server,I am sending data to server using ASIFormDataRequest
POST
request, 我需要向服务器发布一些数据,我正在使用
ASIFormDataRequest
POST
请求向服务器发送数据,
Problem is my server will take response like 问题是我的服务器会像
...
members=[{"EmailId":"sandip.kaptan@alphadezine.in","Name":"sandy"},
...
and my response created as 和我的回应创建为
members="[{\"Name\":\"sandy\",\"EmailId\":\"sandip.kaptan@alphadezine.in\"}]";
i am using following to convert my array to 我正在使用以下将我的数组转换为
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:array];
NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
options:kNilOptions error:nil];
at this point my jsonString
as print as what i want, but when i add this to ASIFormDataRequest request
在这一点上我的
jsonString
作为我想要的打印,但是当我将其添加到ASIFormDataRequest request
`[request addPostValue:jsonString forKey:@"Members"];`
it is added \\
in the value... so how to overcome with this problem.. 它在值中添加了
\\
,因此如何解决此问题。
Have you Check What your server is getting ? 您是否检查服务器正在获取什么? I guess
\\
is added by the ASIFormDataRequest
to make some internal string conversion. 我猜
ASIFormDataRequest
添加了\\
,以进行一些内部字符串转换。 It should send the response without \\
.Your server would have receive the response as you are expecting. 它应发送不带
\\
的响应。您的服务器将按预期接收响应。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.