ObjectMapper mapper = new ObjectMapper();
searchCriteria.put(TICKET_STATUS_LIST,
mapper.writeValueAsString(ticketStatus));
String ticketListJson = mapper.writeValueAsString(tkmTicketList);
String searchCrteriaJson = mapper
.writeValueAsString(searchCriteria);
Map<String, Object> ticketSearchResult = new HashMap<String, Object>();
ticketSearchResult.put("ticketListJson", ticketListJson);
ticketSearchResult.put("searchCriteriaJson", searchCrteriaJson);
ticketSearchResult.put("count", iResultCt);
return mapper.writeValueAsString(ticketSearchResult);
I've come across this delightful code, problem is that the search criteria and ticketListJson end up being treated like strings so I get a crappy json as out:
{"count":7,"searchCriteriaJson":"{\"startRecord\":0,\"sortOrder\":\"DESC\",\"ticketStatus\":\"[\\\"Any\\\"]\",\"pageSize\":10,\"sortBy\":\"Default\",\"customer\":1599}","ticketListJson":"[{\"id\":\"30\",\"subject\":\"Test\",\"number\":\"TIC-30\",...
How can I have these inner json strings maintain their normal values without it adding a bunch of escape characters.