我在 java 脚本中有下一个对象:
var customObj = [];
customObj[customId] = {name:'sample',other:'other'};
customObj[customId2] = {name:'sample2',other:'other2'};
当我尝试解析查询参数时,结果如下:
customObj[0][name]=sample&customObj[0][other]=other&customObj[1][name]=sample2&customObj[1][other]=other2
在 jax rs 我有这个资源:
@GET
public MyObject getSomething(@QueryParam("customObj") customObj /*Here is the problem*/){
for(ObjectOrMapOrListOrArrayList myObject:customObject){
System.out.println(myObject);//prints something like {name:'sample',other:'other'}
}
}
但我不知道如何接收对象参数,我尝试使用 List> 因为在我的对象中所有数据都是字符串但它不起作用,我尝试使用 Map 但我接收
不正确的参数类型错误
.