Class JsonPrinter


  • public class JsonPrinter
    extends Object
    The JsonPrinter class is a utility class, used to print JSONs in their String representation using a specific set of style options.
    • Method Detail

      • printJsonArray

        public static String printJsonArray​(JsonArray jsonArray,
                                            char whitespaceChar,
                                            int whitespaceCharQty,
                                            boolean ignoreNull,
                                            PrintStyle printStyle)
        Returns a String printed with the data of the passed JsonArray in the specified style.
        Parameters:
        jsonArray - the JsonArray
        whitespaceChar - the whitespace char
        whitespaceCharQty - the quantity of whitespace chars to use when producing indent
        ignoreNull - ignore nulls?
        printStyle - the PrintStyle
        Returns:
        the styled JsonObject
      • printJsonObject

        public static String printJsonObject​(JsonObject jsonObject,
                                             char whitespaceChar,
                                             int whitespaceCharQty,
                                             boolean ignoreNull,
                                             PrintStyle printStyle)
        Returns a String printed with the data of the passed JsonObject in the specified style.
        Parameters:
        jsonObject - the JsonObject
        whitespaceChar - the whitespace char
        whitespaceCharQty - the quantity of whitespace chars to use when producing indent
        ignoreNull - ignore nulls?
        printStyle - the PrintStyle
        Returns:
        the styled JsonObject