关于iphone:使用ASIFormDataRequest发布NSArray,但json格式更改,它会附加\\ n

Posting NSArray using ASIFormDataRequest but json format gets changed it appends \n

我真的需要解决此问题,我通过创建请求使用ASIHTTPRequest发布具有少量参数的数组:

1
2
3
4
5
6
7
8
9
10
{
categories={
    attributes=({
        id=1;values=();
    });categories=({
        id=9;values=({
            id=28;
        });
    });
};description=dfsvdsfs;id=0;localid=1;originalid=0;remarks="";sections=();title=Hhhh;}

但是当我在服务器端以json格式发布此内容时,它会更改并添加\\\\
在数组之间:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
{
"sections":"(\
)"
,
"categories":"{\

 attributes = (\
{\
id = 1;\

 values = (\
);\
}\
);\

 categories = (\
{\
id = 9;\

 values = (\
{\
id = 28;\
}\
);\
}\

);\
}"
,
"id":"0",
"originalid":"0",
"localid":"1",
"title":"Hhhh",
"description":"dfsvdsfs",
"remarks":""
}

请建议我我该怎么做?

我尝试删除\\\\
使用:

[值stringByTrimmingCharactersInSet:[NSCharacterSet newlineCharacterSet]];


以这种方式尝试,

1
2
3
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:objcts
          options:NSJSONWritingPrettyPrinted error:&error];
NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];

其中的对象=您的数组