去掉返回的json中特殊字符
private static String jsonString(String s) {
char[] temp = s.toCharArray();
int n = temp.length;
for (int i = 0; i < n; i++) {
if (temp[i] == ':') {
int quentIndex = i + 1;
while (StringUtils.isBlank(String.valueOf(temp[quentIndex]))) {
quentIndex++;
}
if (temp[quentIndex] == '"') {
for (int j = quentIndex + 1; j < n; j++) {
if (temp[j] == '"') {
if (temp[j + 1] != ',' && temp[j + 1] != '}') {
temp[j] = '”';
} else if (temp[j + 1] == ',' || temp[j + 1] == '}') {
break;
}
}
}
}
}
}
return new String(temp);
}
private static String jsonString(String s) { char[] temp = s.toCharArray(); int n = temp.length; for (int i = 0; i < n; i++) { if (temp[i] == ':') { int quentIndex = i + 1; while (StringUtils.isBlank(String.valueOf(temp[quentIndex]))) { quentIndex++; } if (temp[quentIndex] == '"') { for (int j = quentIndex + 1; j < n; j++) { if (temp[j] == '"') { if (temp[j + 1] != ',' && temp[j + 1] != '}') { temp[j] = '”'; } else if (temp[j + 1] == ',' || temp[j + 1] == '}') { break; } } } } } } return new String(temp);————————————————版权声明:本文为CSDN博主「JensonXIE」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。原文链接:https://blog.csdn.net/yefeng0810/article/details/98203137
最新文章
- Notes:SVG(1)
- 提高Baidu Map聚合的效率
- javascript冒泡排序一些新实现
- NIO概述
- A VNC server is already running as :1
- ubuntu安装bower失败的解决方法
- android activity空指针异常解决问题解决
- C#画图
- 在Apache中开启虚拟主机
- Google code: Why ‘Everything up-to-date’ when pushing (git)
- FreeMarker中if标签内的判断条件
- HAOI 硬币购物
- Gmail 一些需注意的事
- IOS优秀博客
- 从硬件竞争到软实力PK——电视媒体竞争观察
- 微信小游戏开发之四:使用three.js引擎
- @Autowired和@Resource注解的一个意外重要区别
- XP下ubuntu双系统安装方法
- JAVA课堂测试之一位数组可视化
- jasperreports实现pdf文档的生成
热门文章
- JSP三大指令是什么?
- 错误:软件包:php-fpm-5.4.16-42.el7.x86_64 需要:php-common(x86-64)
- java并发编程工具类JUC第八篇:ConcurrentHashMap
- ConcurrentSkipListMap - 秒懂
- MySQL:一条SQL是如何执行的
- 分布式事务与Seate框架(3)——Seata的AT模式实现原理
- 利用ServletContext,实现Session动态权限变更
- Oracle数据泵导出数据库
- 详解C++中继承的基本内容
- 《手把手教你》系列技巧篇(七)-java+ selenium自动化测试-宏哥带你全方位吊打Chrome启动过程(详细教程)