JSON httpget URIsyntaxexception在查询中具有非法字符

时间:2011-07-25 20:38:43

标签: android json http-get illegal-characters

07-25 20:05:28.276:ERROR / log_tag(940):http连接错误java.net.URISyntaxException:索引58处查询中的非法字符: http://localhost/test/parsejsonstrtodatabase.php?JSON = [{“endtime”:“2011-07-19 08:21:32”,“clientid”:1001005,“lastupdate”:“2011-07-19 08 :21:32“,”empid“:23456,”starttime“:”2011-07-19 08:21:32“,”lastname“:”Senden“,”tckey“:1,”firstname“:”Kim“ ,“phonenum”:2147483647,“clientkey”:1001005},{“endtime”:“2011-07-19 08:24:43”,“clientid”:1001002,“lastupdate”:“2011-07-19 08: 24:43“,”empid“:12345,”starttime“:”2011-07-19 08:24:43“,”lastname“:”Frenzo“,”tckey“:2,”firstname“:”Mary“, “PHONENUM”:2147483647, “clientkey”:1001002}]

尝试使用httpget将JSON字符串从Android发送到远程服务器,但在此步骤失败,我不太确定可能出错,谢谢。

1 个答案:

答案 0 :(得分:-1)

基本上,一些JSON解析器是严格的。

在你的JSON中,你有像

这样的key.values
"clientkey" : 1001002

虽然有些解析器允许这样做,但其他人希望能够像

一样进行包装
"clientkey" : "1001002"

JSON没有根据" "引号对数字值的字符串字符串进行差异,基本上所有内容都应该被包装。

相关问题