后端接口:
@PostMapping("/compose/{id}")
public Message compose(@PathVariable String id, @RequestBody List<List<String>> data) {
}
前端传的数据如下:
[
[null,"2016-12-31","2016-12-31","2016-12-31","2016-12-31","2016-12-31","2016-12-31"],
["","营业收入","营业成本","营业收入","营业成本","营业收入","营业成本"],
["华北","10,395.82","4.73","8,041.72","3.65","7,202.08","7,202.08"],
["华东","78,942.98","35.93","76,100.98","34.53","70,450.89","70,450.89"],
["华南","16,343.33","7.44","21,176.08","9.61","22,709.62","22,709.62"],
["华中","41,575.34","18.92","37,104.71","16.84","39,294.05","39,294.05"],
["西北","4,581.72","2.09","5,273.01","2.39","4,261.26","4,261.26"],
["西南","64,956.49","29.57","69,146.78","31.38","72,990.61","72,990.61"],
["境外","1,126.66","0.51","1,278.24","0.58","1,284.34","1,284.34"],
["合计","219,704.55","100.00","220,385.17","100","221,530.55","221,530.55"]
]
前端代码如下,用的angular.js的$http:
// 其中data就是二维数组
$http.post(url, data).then(response => {});
报错如下:
[WARN] DefaultHandlerExceptionResolver Line:384 - Failed to read HTTP message: org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Can not deserialize instance of java.util.ArrayList out of START_OBJECT token; nested exception is com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.util.ArrayList out of START_OBJECT token
后端该怎么处理才能接到二维数组。
直接String data接收不到吗?