Javascript SyntaxError:JSON分析错误:React Native中出现意外的EOF

Javascript SyntaxError:JSON分析错误:React Native中出现意外的EOF,javascript,json,api,react-native,Javascript,Json,Api,React Native,我正在尝试在我的详细信息页面中显示数据。当我在索引屏幕中单击查看按钮时。它将指向详细页面屏幕。因此,我单击查看按钮来解决这个[SyntaxError:JSON解析错误:意外的EOF]问题 我的API代码: //get data from api _loadInitialState = async () => { const token = await AsyncStorage.getItem('token'); const myArray = a

我正在尝试在我的详细信息页面中显示数据。当我在索引屏幕中单击查看按钮时。它将指向详细页面屏幕。因此,我单击查看按钮来解决这个
[SyntaxError:JSON解析错误:意外的EOF]
问题

我的API代码:

 //get data from api
    _loadInitialState = async () => {

        const token = await AsyncStorage.getItem('token');
        const myArray = await AsyncStorage.getItem('language_type');
        _onSetLanguage(myArray)

        var loadAll = this.props.navigation.getParam('loadAll');
        if (loadAll == true) { this.setState({ isLoading: true }) }

        var have_access = this.props.navigation.getParam('have_access');
        if (have_access != undefined) { this.setState({ have_access: have_access }) }
        if (staticData.get_centre_settings() != null) { this.setState({ have_access: true }) }

        let today = Moment();
        this.setState({
            today: Moment(today).format('YYYY-MM-DD'),
        })

        this.setState({ token: token });
        var staff_id = this.props.navigation.getParam('id');
        this.setState({ staff_id: staff_id });


        fetch(FetchURL.get_baseURL() +  "leave/" + staff_id , {
            method: 'GET',
            headers: {
                'Authorization': 'Bearer '+ token,

            }
        })
        .then(response => response.json())
        .then((json) => {
             alert(json)
            if (json.error) {
                alert(json.error);
            } else {
                this.setState({
                    staffLeave: json,
                    isLoading: false
                });


            }

        })
        .catch((err) => {
            console.log(err)
            alert(err)
            // alert(strings.data_fail);
        })
    this.setState({ view_access: true })


    }

我认为API工作正常,因为我在POSTMAN中测试了API。我的数据显示出来了

检查浏览器开发人员工具中的“网络”部分。发布来自服务器的确切响应正文。您所说的
来自服务器的确切响应正文
this是指服务器路由
FetchURL.get_baseURL()+“leave/”+staff_id
发送回客户端的内容。