Let say I have a JSON format string to provide as the response for Angular/AmChart to consume. How can I put and parse the response under SpringBoot2? I tried to put the sample response into a hashmap, but the postman shows that the JSON string did not append to the response.
Code goes here:
@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;
}
Postman result:
{
"timestamp": "May 5, 2020 3:50:49 PM",
"details": "uri=/api/candlestick"
}
Seems "String json" is null because there is no "@Param Sting json". if json not null it will be work