Class JsonToYamlExtensions

java.lang.Object
io.github.astrapi69.json.JsonToYamlExtensions

public final class JsonToYamlExtensions extends Object
The class JsonToYamlExtensions helps to transform a given json string to a yaml string
  • Method Details

    • toYaml

      public static String toYaml(String jsonString) throws com.fasterxml.jackson.core.JsonProcessingException
      Transform the given json as String object to a yaml as String object
      Parameters:
      jsonString - the json as String object
      Returns:
      the transformed yaml as String object
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException - If an error occurs when converting object to String
    • toYaml

      public static String toYaml(File jsonFile) throws IOException
      Transforms the given json file into a yaml as String object
      Parameters:
      jsonFile - the json file
      Returns:
      the transformed yaml as String object
      Throws:
      IOException - Signals that an I/O exception has occurred
    • toYaml

      public static void toYaml(File jsonFile, File resultYamlFile) throws IOException
      Transforms the given json file into a yaml as File object
      Parameters:
      jsonFile - the json file
      resultYamlFile - the result file in yaml format
      Throws:
      IOException - Signals that an I/O exception has occurred