假设我有一个JSON格式的字符串作为响应提供给Angular/AmChart使用。如何在SpringBoot2下放置和解析响应?我尝试将示例响应放入hashmap中,但邮递员显示JSON字符串没有附加到响应中。
代码如下:
@GetMapping("/candlestick")
public HashMap<String, Object> getAllPlot(String json) {
HashMap<String, Object> map = new HashMap<>();
json = json.substring(0, json.length() - 1);
json = "[" + json+" whatever here";
json = json + "]";
map.put("data", json);
return map;
}邮递员结果:
{
"timestamp": "May 5, 2020 3:50:49 PM",
"details": "uri=/api/candlestick"
}发布于 2020-05-05 16:24:23
"String json“似乎是空的,因为没有"@Param Sting json”。如果json不为空,则它将工作
https://stackoverflow.com/questions/61608395
复制相似问题