Class JsonPrettyPrinter


  • public class JsonPrettyPrinter
    extends java.lang.Object
    This class can "pretty-print" JSON text for diagnostic purposes.
    Since:
    MicroStrategy Web 9.0.0
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String prettyPrintJSON​(java.io.File f, int indentLevel)
      Pretty Print the JSON in the supplied file using the specified indentation level.
      static java.lang.String prettyPrintJSON​(java.lang.String jsonText, int indentLevel)
      Pretty Print the JSON in the supplied string using the specified indentation level.
      • Methods inherited from class java.lang.Object

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

      • JsonPrettyPrinter

        public JsonPrettyPrinter()
    • Method Detail

      • prettyPrintJSON

        public static java.lang.String prettyPrintJSON​(java.io.File f,
                                                       int indentLevel)
        Pretty Print the JSON in the supplied file using the specified indentation level.
        Parameters:
        f - The File object that contains the file to pretty print.
        indentLevel - The number of spaces at each indentation level.
        Returns:
        A pretty printed version of the text in the file.
        Throws:
        java.lang.IllegalArgumentException - If the supplied file does not exist or cannot be read.
      • prettyPrintJSON

        public static java.lang.String prettyPrintJSON​(java.lang.String jsonText,
                                                       int indentLevel)
        Pretty Print the JSON in the supplied string using the specified indentation level.
        Parameters:
        jsonText - The JSON text to pretty print.
        indentLevel - The number of spaces at each indentation level.
        Returns:
        A pretty printed version of the text in the supplied string.