将静态json字符串存储到字符串中
我试图以下面的方式存储json字符串将静态json字符串存储到字符串中,json,nsstring,apex-code,Json,Nsstring,Apex Code,我试图以下面的方式存储json字符串 NSString * str =@"{"CategoryID":1,"ItemCount":1,"level":1,"Name":"Boots","Description":"Boots descrition","childs":[{"CategoryID":2,"ItemCount":1,"level":2,"Name":"Cold Water","Description":"Cold Water Description","childs":[]}]}]"
NSString * str =@"{"CategoryID":1,"ItemCount":1,"level":1,"Name":"Boots","Description":"Boots descrition","childs":[{"CategoryID":2,"ItemCount":1,"level":2,"Name":"Cold Water","Description":"Cold Water Description","childs":[]}]}]";
我收到一条错误消息。我知道这是一个非常小的解决方案。
我尝试了很多NSString方法,但没有找到解决方案。
如何存储此字符串
提前感谢…我终于找到了问题的答案 我们需要用下面的方法传递字符串
NSString*str=@{\"CategoryID\":1,\"ItemCount\":1,\"level\":1,\"Name\":\"Boots\",\"Description":\"Boots descrition\",\"childs\"[{\"CategoryID\":2,\"ItemCount\":1,\"level\":2,\"Name\":\"Cold Water\",\"Description\":\"Cold Water Description\",\"childs\":[]}]}];
“我收到一条错误消息”。那是什么?错误应该是“;”在宣言末尾