“Token inesperado W en JSON en la posición 0” Código de respuesta

Token inesperado W en JSON en la posición 0

Unexpected token W in JSON at position 0

It's because a simple string (plain text) is returned as the response. The text is not a valid JSON. So when you try to do res.json(), it calls JSON.parse(data). Try and do it with the string you provided, and you will get the same error.

use res.text() instead of res.json()
aus ogola

Token inesperado W en JSON en la posición 0

Unexpected token W in JSON at position 0

It's because a simple string (plain text) is returned as the response. The text is not a valid JSON. So when you try to do res.json(), it calls JSON.parse(data). Try and do it with the string you provided, and you will get the same error.

use res.text() instead of res.json()
aus ogola

buscar sintaxerror: token inesperado
JSON.parse(theStringThatIsNotJson);

Breakable Beaver

Token inesperado W en JSON en la posición 0

Unexpected token W in JSON at position 0

It's because a simple string (plain text) is returned as the response. The text is not a valid JSON. So when you try to do res.json(), it calls JSON.parse(data). Try and do it with the string you provided, and you will get the same error.

use res.text() instead of res.json()
aus ogola

Respuestas similares a “Token inesperado W en JSON en la posición 0”

Preguntas similares a “Token inesperado W en JSON en la posición 0”

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código