【发布时间】:2020-05-21 03:38:57
【问题描述】:
我正在尝试使用 axios 使用 get 方法发送嵌套的 json 数据,但问题是后端将子项视为字符串。
const TOKEN = "token"
const config = {
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': TOKEN,
},
data: {},
params: {
"page_id": 1,
"filter": {
"search": "name"
}
}
};
axios.get("http://localhost/api/pages", config)
如果我想在后端打印 filter 我会得到什么:
"{"search": "name"}"
【问题讨论】:
-
config.params.filter
标签: javascript json get nested axios