Я ожидаю вывод точно как показано ниже (вы видите одинарные кавычки)
{
"success": true,
"friends": ['Kanchhi@example.com','modi@example.com','maya@example.com','jetli@example.com','john@example.com'] ,
"count": 5
}
но в настоящее время я получаю так: (мы должны удалить двойные кавычки из этого)
{
"success": true,
"friends": "['Kanchhi@example.com','modi@example.com','maya@example.com','jetli@example.com','john@example.com']",
"count": 5
}
Метод отдыха
@PostMapping(path = "/my", consumes = MediaType.TEXT_PLAIN_VALUE)
public ResponseEntity<Map> getFriendListByEmail(@Valid @RequestBody String value) {
LinkedHashMap<Object, Object> map23 = new LinkedHashMap<>();
myList=userService.getfriendList(value); //getting some list say we have got 5 list of emails
String s ="'"+myList.toString().replace("[","").replace("]", "").replace(" ","").replace(",","','")+"'";
map23.put("success", true);
map23.put("friends", "["+s+"]"); // trying to put the updated string
map23.put("count", myList.size());
return new ResponseEntity<Map>(map23, HttpStatus.OK);
}