I want to send an array of objects to my backend. I use axios for this. The backend is called but I only get an array of [Object object] elements.
Frontend:
Backend:
@PostMapping("/neuerEintrag")
public String neuerEintrag(HttpServletRequest req, @RequestParam("zugeordnet") List<?>
zugeordnet,..) {
....
}
Result in Backend:
[[object Object], [object Object]]
You're trying to send an object instead of a JSON string. If the object you're trying to send is in the variable data
, you'll need to wrap it in JSON.stringify
where you use it within the axios call
JSON.stringify(data)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.