[英]How to handle List of multidimensional array as @RequestParam in Spring boot
I need to get value in request body for list of multidimensional array我需要在请求正文中获取多维数组列表的值
@RequestBody CreateRequest createRequest @RequestBody 创建请求 创建请求
@Getter
@Setter
public class CreateRequest {
private String id;
private List<PolygonRequest> boundaries;
@Getter
@Setter
public static class PolygonRequest {
private String[][] boundary;
}
}
JSON like, JSON之类的,
{
"id": "Zone 112",
"boundaries": [
[
[-5.2,-6.2],
[-4.5,-7.8]
],
[
[7.2,-1.6],
[-3.3,-8.1]
]
]
}
When I create like this It is getting Bad request error当我这样创建时,出现错误请求错误
"status": 400,
"error": "Bad Request"
Try using the below Array declaration for accessing the String boundary.尝试使用下面的数组声明来访问字符串边界。
private String[][][] boundary;
Also, check for the data type you need(String or Double).此外,检查您需要的数据类型(字符串或双精度)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.