Class JsonToYamlExtensions


  • public final class JsonToYamlExtensions
    extends java.lang.Object
    The class JsonToYamlExtensions helps to transform a given json string to a yaml string
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String toYaml​(java.io.File jsonFile)
      Transforms the given json file into a yaml as String object
      static void toYaml​(java.io.File jsonFile, java.io.File resultYamlFile)
      Transforms the given json file into a yaml as File object
      static java.lang.String toYaml​(java.lang.String jsonString)
      Transform the given json as String object to a yaml as String object
      • Methods inherited from class java.lang.Object

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

      • toYaml

        public static java.lang.String toYaml​(java.lang.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 java.lang.String toYaml​(java.io.File jsonFile)
                                       throws java.io.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:
        java.io.IOException - Signals that an I/O exception has occurred
      • toYaml

        public static void toYaml​(java.io.File jsonFile,
                                  java.io.File resultYamlFile)
                           throws java.io.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:
        java.io.IOException - Signals that an I/O exception has occurred