如何获取 express req.body 中字符串中的对象?
how to get a object that is in string inside the req.body in express?
我正在尝试从前端获取对象,但我面临的问题是前端正在 qoutes 中发送该对象
Preview URL: false
[Object: null prototype] {
name: 'Arun Teltia',
email: 'acfsdzvff@gmail.com',
message: 'test',
'g-recaptcha-response': '',
contact: 'contact'
}
这是我得到的响应 我想在我的后端提取 g-recaptcha-response 我该怎么做?
我尽可能多地解释,我也尝试在 google 上搜索,但我找不到任何东西,谢谢你提前的帮助:D
您可以使用 括号表示法 访问对象的 属性:
obj['g-recaptcha-response']
我正在尝试从前端获取对象,但我面临的问题是前端正在 qoutes 中发送该对象
Preview URL: false
[Object: null prototype] {
name: 'Arun Teltia',
email: 'acfsdzvff@gmail.com',
message: 'test',
'g-recaptcha-response': '',
contact: 'contact'
}
这是我得到的响应 我想在我的后端提取 g-recaptcha-response 我该怎么做?
我尽可能多地解释,我也尝试在 google 上搜索,但我找不到任何东西,谢谢你提前的帮助:D
您可以使用 括号表示法 访问对象的 属性:
obj['g-recaptcha-response']