Json-c库解析包含url的json字符串问题

json-c库会把url中的'/'转译为'\/';

可能是json-c规则里面'/'字符另有他用吧;

只能自己编写代码处理一下:

 1 int strdelchr(char *str, char ch)
 2 {
 3     char *p ,*q ;
 4 
 5     for(p=str,q=str; *p!='\0'; p++)
 6     {
 7         if(*p!=ch)
 8             *q++=*p;
 9     }
10     *q=*p;
11     return 0;
12 }

调用该方法:

1 char download_url[1024] = "http://www.google.com/xxx.xxx/";
2 strdelchr(download_url, '\\');

 

posted on 2018-04-25 16:42  lingzshen  阅读(350)  评论(0编辑  收藏  举报