js error Unexpected end of JSON input, Unexpected token u in JSON at position 0
JSON is usually used to exchange data with the server.
When receiving server data, it is generally a character string.
We can use the JSON.parse() method to convert the data into JavaScript objects.
Try the returned results of these kinds of parameters in the Console debugging platform of Google Chrome:
It can be found that the parameters of JSON.parse() must conform to the format of the JSON string to be correctly converted into objects, otherwise it may cause errors and affect other codes.
When we are not sure about the type of data returned by the server, these few examples can be used: