[英]JSON Parse error: Unexpected identifier "be"
我弹出了我的 CRNA 应用程序,我编译了它并在我的 android 设备上运行它。 然后我在尝试在应用程序中搜索电影时遇到此错误,该应用程序由以下代码管理。 有什么解决办法吗?
const API_TOKEN = "********************************";
export function getFilmsFromApiWithSearchedText(text, page){
const url = 'https://api.themoviedb.org/3/search/movie?api_key=' + API_TOKEN
+ '&language=fr&query=' + text + "&page=" + page
return fetch(url)
.then((response) => response.json())
.catch((error) => console.error(error))
}
export function getImageFromApi(name){
return 'https://image.tmdb.org/t/p/w300' + name
}
export function getFilmDetailFromApi(id){
return fetch('https://api.themoviedb.org/3/movie/' + id + '?api_key=' +
API_TOKEN + '&language=fr')
.then((response) => response.json())
.catch((error) => console.error(error));
}
尝试这个:
this.state = {
...
responseDATA = '', //You can also use an array
}
export function getFilmDetailFromApi(id){
return fetch('https://api.themoviedb.org/3/movie/' + id + '?api_key=' + API_TOKEN + '&language=fr')
.then((response) => response.json())
.then((responseJson) => {
this.state.responseDATA = responseJson.movie //here movie is path of the data that you want from the JSON recieved
})
.catch((error) => console.error(error));
}
我遇到了同样的问题,但最后
我找到它了
“api 已关闭”
你可以检查你的api密钥
我有完全相同的问题,我刚刚找到了解决方案。
问题是 TheMovieDB,如果您尝试在浏览器中运行 url,您会看到“马上回来”
但是在 URL 中,您只需要将“3”更改为“4”就可以了! (我无法解释为什么,但它有效!)
https://api.themoviedb.org/ 4 /search/movie?api_key=xxxxxxxxxxxxxxxxx&language=fr&query=super
;)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.