Class JSONSanitizer


  • public class JSONSanitizer
    extends java.lang.Object
    Simple JSON sanitizer to allow special characters in JSON input. It also replaces control characters (newline, tab) and replaces them with html-friendly versions
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static JSONSanitizer getInstance()  
      java.lang.String sanitize​(java.lang.String dirtyString)
      Sanitizes the input string so that it can be represented in JSON
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • sanitize

        public java.lang.String sanitize​(java.lang.String dirtyString)
        Sanitizes the input string so that it can be represented in JSON
        Parameters:
        dirtyString - The un-sanitized string
        Returns:
        The sanitized string that can be directly added to a JSON command