前端let map = new Map();
map.set(1, 1);
map.set(2, 2);
map.set(3, 3);
//map转obj
let obj= Object.create(null);
for (let[k,v] of map) {
obj[k] = v;
}
$.ajax({
url:"",
type:"POST",
dataType:'json',
contentType : 'application/json;charset=utf-8',
data:JSON.stringify(obj), //obj转json
success:function (data) {
}
})后端
@PostMapping("")
public void xxx(@RequestBody Map<String,Object> map){
System.out.println(map);
}
前端map传给后端接收
最新推荐文章于 2024-06-30 03:23:27 发布