踩了个大坑……
场景
通过socket接受了一个json格式的字符串,解析字符串时,报错:
: not close json text, token : error
at (:1290)
at (:106)
at (:93)
at (:164)
at $(:170)
at (:85)
at .invoke0(Native Method)
at (:39)
at (:25)
at (:597)
at (:317)
at (:190)
at (:157)
at (:72)
at (:179)
at (:207)
at $(Unknown Source)
at (:46)
at .invoke0(Native Method)
at (:39)
at (:25)
at (:597)
at (:175)
at (:446)
at (:434)
at (:945)
at (:876)
at (:961)
at (:852)
at (:624)
at (:837)
at (:731)
at (:303)
at (:208)
at (:123)
at (:241)
at (:208)
at (:88)
at (:108)
at (:241)
at (:208)
at (:220)
at (:122)
at (:505)
at (:169)
at (:103)
at (:956)
at (:116)
at (:436)
at .http11.(:1078)
at $(:625)
at $(:2517)
at $(:2506)
at $(:886)
at $(:908)
at $(:61)
at (:619)
注:以下为原文作者原话
问题描述:
web项目开启一个socketserver,通过socket传递的json数据,出现上面的问题
解决办法:
后台获得字符串trim()一下,问题解决.
注意:此问题只限socket传递的字符串问题解决方法,只是困扰我的问题,如果你看到这个文章了,也遇到同样的问题,但是无法解决,应该是问题不相同
注:大神解决了困扰我一下午及晚上的问题……
作者:张大强
来源:****
原文:/yaqiang520/article/details/50470205#commentBox