Package io.github.astrapi69.yaml
Class YamlToJsonExtensions
- java.lang.Object
-
- io.github.astrapi69.yaml.YamlToJsonExtensions
-
public final class YamlToJsonExtensions extends java.lang.Object
The classYamlToJsonExtensions
helps to transform a given yaml string to a json string
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
toJson(java.io.File yamlFile)
Transforms the given yaml file into a json asString
objectstatic java.lang.String
toJson(java.io.File yamlFile, boolean prettyPrint)
Transforms the given yaml file into a json asString
objectstatic void
toJson(java.io.File yamlFile, java.io.File resultJsonFile)
Transforms the given yaml file into a json asFile
objectstatic java.lang.String
toJson(java.lang.String yamlString)
Transform the given yaml asString
object to a json asString
objectstatic java.lang.String
toJson(java.lang.String yamlString, boolean prettyPrint)
Transform the given yaml asString
object to a json asString
object
-
-
-
Method Detail
-
toJson
public static java.lang.String toJson(java.lang.String yamlString) throws com.fasterxml.jackson.core.JsonProcessingException
Transform the given yaml asString
object to a json asString
object- Parameters:
yamlString
- the yaml asString
object- Returns:
- the transformed json as
String
object - Throws:
com.fasterxml.jackson.core.JsonProcessingException
- If an error occurs when converting object to String
-
toJson
public static java.lang.String toJson(java.lang.String yamlString, boolean prettyPrint) throws com.fasterxml.jackson.core.JsonProcessingException
Transform the given yaml asString
object to a json asString
object- Parameters:
yamlString
- the yaml asString
objectprettyPrint
- the flag that indicates if the output json string should be pretty formatted- Returns:
- the transformed json as
String
object - Throws:
com.fasterxml.jackson.core.JsonProcessingException
- If an error occurs when converting object to String
-
toJson
public static java.lang.String toJson(java.io.File yamlFile) throws java.io.IOException
Transforms the given yaml file into a json asString
object- Parameters:
yamlFile
- the yaml file- Returns:
- the transformed json as
String
object - Throws:
java.io.IOException
- Signals that an I/O exception has occurred
-
toJson
public static java.lang.String toJson(java.io.File yamlFile, boolean prettyPrint) throws java.io.IOException
Transforms the given yaml file into a json asString
object- Parameters:
yamlFile
- the yaml fileprettyPrint
- the flag that indicates if the output json string should be pretty formatted- Returns:
- the transformed json as
String
object - Throws:
java.io.IOException
- Signals that an I/O exception has occurred
-
toJson
public static void toJson(java.io.File yamlFile, java.io.File resultJsonFile) throws java.io.IOException
Transforms the given yaml file into a json asFile
object- Parameters:
yamlFile
- the yaml fileresultJsonFile
- the result file in json format- Throws:
java.io.IOException
- Signals that an I/O exception has occurred
-
-