Development found that the server occasionally sends the wrong format JSON to the Android client, causing the Android client JSON parsing to fail and apply the exception.
Instead of having the server intentionally pit the client, the data may be mixed with other data in addition to the correct JSON data when the client requests the server data.
For example:
When thinkphp turns on ' Show_page_trace ' and true, the correct JSON will be followed by HTML code,
Workaround:
1. Set the ' Show_page_trace ' =>false to False. But not very practical, because the server may be a problem, when you need to turn on debug mode
2. Client determines JSON parsing failure, using try catch to determine JSON format
(1) client-side judgment JSON format
(2) The client submits the data to the server via the volley post method
(2) The server obtains the client-submitted information through the I () method, where the I () method is a method in thinkphp, which is the method to get all the submitted information, regardless of the client commits in any way, will get its key value pair
Android determines JSON format and submits error messages to the server