Skip to content

Instantly share code, notes, and snippets.

@joubin
Created December 12, 2018 22:12
Show Gist options
  • Save joubin/134b3e8545a2014a9ecfc0afeef3333e to your computer and use it in GitHub Desktop.
Save joubin/134b3e8545a2014a9ecfc0afeef3333e to your computer and use it in GitHub Desktop.
Map<String, Object> commentMap = (new JacksonJsonParser()).parseMap(commentStr);
String textComment = String.valueOf(commentMap.get("text"));
String htmlEscapedTextComment = HtmlUtils.htmlEscape(textComment);
commentMap.put("text", htmlEscapedTextComment);
try {
commentStr = (new ObjectMapper()).writeValueAsString(commentMap);
} catch (JsonProcessingException ignored) {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment