US States

FREEMIUM
Verified
Durch Aptitude Apps, LLC | Aktualisiert vor 2 Monaten | Data
Popularität

8.6 / 10

Latenz

491ms

Service Level

100%

Health Check

N/A

Zurück zu allen Diskussionen

API Error

Rapid account: Ekoen 56
ekoen56
vor einem Jahr

I am getting an error and I don’t know what it means. I haven’t changed anything in the code segment that fetches data from the API and stores it.

This is the error: Error: “Unexpected token ‘O’, “Oops, an e”… is not valid JSON” in SyntaxError: Unexpected token ‘O’, “Oops, an e”… is not valid JSON"

Here’s the code:

const options = {
method: ‘GET’,
headers: {
‘X-RapidAPI-Key’: ‘0c7e651446msh9d309a885c79429p1421dejsna49fa790aca8’,
‘X-RapidAPI-Host’: ‘us-states.p.rapidapi.com’,
},
};
componentDidMount = () => {
return fetch(‘https://us-states.p.rapidapi.com/all’, options)
.then((response) => response.json())
.then((response) => {
console.log(response);
this.setState({
isLoading: false,
dataSource: response,
});
})
.catch((error) => {
console.log(error);
});
};

Nehmen Sie an der Diskussion teil - fügen Sie unten einen Kommentar hinzu:

Anmelden / Registrieren, um neue Kommentare zu veröffentlichen