JSON经典异常:org.json.JSONException: Unterminated string at character
2014-02-10 16:23
561 查看
在用json提交数据的时候发现有时候会报这个异常,经过跟踪后台以及录入的数据发现用户在录入完成后习惯在句末加一个回车符,导致json格式不符合要求。根据这个发现找出的解决办法是将该变量中所有的换行符进行替换。在展示的时候使用硬换行就可以了。
var str=str_temp.replace(/[\n]/ig,'');将该变量中出现的所有的换行符转换成空格。
相关文章推荐
- JSON经典异常:org.json.JSONException: Unterminated string at character
- Json数据解析异常:org.json.JSONException: Unterminated object at character
- Android异常汇集----2. org.json.JSONException: Unterminated string at character
- net.sf.json.JSONException: Unterminated string at character 2101
- 异常:org.json.JSONException: End of input at character 0 of
- org.json.JSONException: End of input at character 0 of 异常
- org.json.JSONException: Unterminated object at character 97 of
- JSON转换出现错误:net.sf.json.JSONException: Unterminated string at character 38 of
- net.sf.json.JSONException: Unterminated string at character 1801
- JSON转换出现错误:net.sf.json.JSONException: Unterminated string at character 38 of
- org.json.JSONException:End of input at character 0 of
- org.json.JSONException: End of input at character 0 of
- org.json.JSONException: End of input at character 0 of解决
- bug_ _org.json.JSONException: End of input at character 0 of
- 代码消息org.json.JSONException: End of input at character 0 of
- org.json.JSONException: End of input at character 0 of
- android中Http访问时 connection.getResponseCode()不被执行,且报错 org.json.JSONException: End of input at character 0 of .
- Android学习——org.json.JSONException: End of input at character 0 of
- org.json.JSONException: End of input at character 0 of问题解决
- 【Json】关于json解析时异常org.json.JSONException: A JSONObject text must begin with '{' at character 1 of {的解决方法