gogoWebsite

【Java】An error is reported when parsing strings from sockets: not close json text, token: error solution

Updated to 19 hours ago

Stepping into a big pit...

Scene

I accepted a string in json format through socket. When parsing the string, an error was reported:

: 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)

Note: The following are the original words of the original author

Question description:

The web project opens a socketserver and passes the json data through the socket, and the above problem occurs

Solution:

Get the string trim() in the background and the problem is solved.

Notice:This problem is only limited to the string passed by socket problem solution, it is just a problem that bothers me. If you see this article, you also encounter the same problem, but it cannot be solved, it should be that the problem is different.


Note: The master solved the problem that troubled me all afternoon and evening...

author:Zhang Daqiang

Source: CSDN

original:/yaqiang520/article/details/50470205#commentBox