字典或者数组类型的参数应转成Json字符串的格式传给后台
[self dicToJsonStr:"rate_data" : [
{
"rate_id" : "43",
"good_id" : "6"
},
{
"rate_id" : "37",
"good_id" : "5"
},
{
"rate_id" : "33",
"good_id" : "4"
}
],
]
- (NSString *)dicToJsonStr:(NSArray *)dic
{
NSError *parseError = nil;
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dic options:NSJSONWritingPrettyPrinted error:&parseError];
return [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
}
网友评论