I have a function which is returning Data as List in java class. Now as per my need, I have to convert it into Json Format.
List
Json
Below is my fun
Try these simple steps:
ObjectMapper mapper = new ObjectMapper(); String newJsonData = mapper.writeValueAsString(cartList); return newJsonData; ObjectMapper() is com.fasterxml.jackson.databind.ObjectMapper.ObjectMapper();