JsonParseException: Unexpected character ('' (code 65279 / 0xfeff)): expected a valid value
2017-11-02 13:48
197 查看
【问题】
从文件中读字符串内容,使用 org.codehaus.jackson.map.ObjectMapper。将json转java对象时,
异常:org.codehaus.jackson.JsonParseException: Unexpected character ('' (code 65279 / 0xfeff)): expected a valid value
【原因】收到的json串包含UTF-8 的bom不可见字符
【解决】
改为
以UTF-8 无BOM格式编码
从文件中读字符串内容,使用 org.codehaus.jackson.map.ObjectMapper。将json转java对象时,
异常:org.codehaus.jackson.JsonParseException: Unexpected character ('' (code 65279 / 0xfeff)): expected a valid value
【原因】收到的json串包含UTF-8 的bom不可见字符
【解决】
改为
以UTF-8 无BOM格式编码
相关文章推荐
- flume nginx 日志处理异常 JsonParseException: Unexpected character ('(' (code 40)): expected a valid value
- org.codehaus.jackson.JsonParseException: Unexpected character ('<' (code 60)): expected a valid valu
- org.codehaus.jackson.map.JsonMappingException: Can not construct instance of java.util.Date from String value '2012-12-12 12:01:01': not a valid representation (error: Can not parse date "2012-12-
- org.codehaus.jackson.JsonParseException: Unexpected character ('e' (code 101)): was expecting comma
- 一次 JMeter 脚本请求错误 Could not read JSON: Unexpected character : expected a valid value 的解决笔记
- 一次 JMeter 脚本请求错误 Could not read JSON: Unexpected character : expected a valid value 的解决笔记
- Unexpected character ('<' (code 60)): expected a valid value ...
- JsonParseException: Unexpected character ('?' (code 239)): was expecting comma to separate OBJECT en
- JsonParseException: Unexpected character ('?' (code 255))
- org.codehaus.jackson.JsonParseException: Illegal unquoted character ((CTRL-CHAR, code 10)): has to b
- com.sun.pdfview.PDFParseException: Expected 'xref' at start of table
- org.codehaus.jackson.JsonParseException: Invalid UTF-8 start byte 0xb2
- JSONException: Value of type java.lang.String cannot be converted to JSONObject
- net.sf.json.JSONException: Expected a ',' or '}' at character 546 of
- Json解析异常处理方式(JSONException: Value of type java.lang.String cannot be converted to JSONObject)
- org.springframework.dao.InvalidDataAccessApiUsageException: Parameter value [41] did not match expected type [java.lang.Integer (n/a)];
- ERROR spi.SqlExceptionHelper : 'Infinity' is not a valid numeric or approximate numeric value 问题解决
- org.json.JSONException: Value
- 【tomcat】org.xml.sax.SAXParseException: Open quote is expected for attribute "{1}" associated
- org.json.JSONException: Value of type java.lang.String cannot be converted to JSONArra