如何将嵌套体添加到fetch

问题描述

如何在fetch()函数中添加嵌套体?

我有这个身体:

{
                "locations": [
                    {
                        "latLng": {
                            "lat": 123,"lng": 123
                        }
                    },{
                        "latLng": {
                            "lat": 123,"lng": 123
                        }
                    }
                ]
            }

我尝试使用此代码,但返回了SyntaxError: Unexpected token o in JSON at position 1

fetch(url,{
        method: "post",headers: {
            'Accept': 'application/json','Content-Type': 'application/json'
        },body: {
                "locations": [
                    {
                        "latLng": {
                            "lat": 53.438679,"lng": 14.520770
                        }
                    },{
                        "latLng": {
                            "lat": 53.450439,"lng": 14.536400
                        }
                    }
                ]
            }
    });

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)