簡體   English   中英

如何在Spring boot中將多維數組列表處理為@RequestParam

[英]How to handle List of multidimensional array as @RequestParam in Spring boot

我需要在請求正文中獲取多維數組列表的值

@RequestBody 創建請求 創建請求


@Getter
@Setter
public class CreateRequest {

    private String id;
    private List<PolygonRequest> boundaries;

    @Getter
    @Setter
    public static class PolygonRequest {
        private String[][] boundary;
    }

}

JSON之類的,

{
    "id": "Zone 112",
    "boundaries": [
        [
            [-5.2,-6.2],
            [-4.5,-7.8]
        ],
        [
            [7.2,-1.6],
            [-3.3,-8.1]
        ]
    ]
}

當我這樣創建時,出現錯誤請求錯誤

"status": 400,
"error": "Bad Request"

嘗試使用下面的數組聲明來訪問字符串邊界。

private String[][][] boundary;

此外,檢查您需要的數據類型(字符串或雙精度)。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM