Class FormatDirector

java.lang.Object
put.ai.se.jsontools.core.format.FormatDirector

public class FormatDirector extends Object
It performs formatting operations such as minification, prettification, and filtering on the JSON string.
  • Constructor Details

    • FormatDirector

      public FormatDirector()
  • Method Details

    • formatJson

      public static String formatJson(String source, FormatArguments arguments) throws IllegalArgumentException
      Formats the provided JSON string using the specified formatting parameters.
      Parameters:
      source - The JSON string to be formatted.
      arguments - The formatting parameters specifying the desired formatting options: keys to be included or excluded, and flags exclude and prettify.
      Returns:
      The formatted JSON string.
      Throws:
      IllegalArgumentException - If the provided source is not a valid JSON string or if there is an error during the formatting process.
    • formatJson

      public static String formatJson(com.google.gson.JsonObject source, FormatArguments arguments) throws IllegalArgumentException
      Throws:
      IllegalArgumentException