美文网首页
JsonObject解析url报Method threw 'or

JsonObject解析url报Method threw 'or

作者: Silen_ | 来源:发表于2018-12-05 20:53 被阅读0次

假如你有一段json串是这样的:{url:http://www.baidu.com}

你看起来很正常 但是解析的时候会发现..真**坑爹

原因是因为://需要转换成编码也就是这个样{url:http%3A%2F%2Fwww.baidu.com}

menu.saveimg.savepath20181205204857.jpg

程序对url解码:

import java.io.UnsupportedEncodingException;

import java.net.URLDecoder;

String deurl = URLDecoder.decode(url,"UTF-8");

必须加编码UTF-8或者正文的编码GB2312

相关文章

网友评论

      本文标题:JsonObject解析url报Method threw 'or

      本文链接:https://www.haomeiwen.com/subject/mmqgcqtx.html