This post explains unmarshalling information stored in YAML format to java object . This can be achieved with the help of YAMLMapper provided by jackson package. To explain with an example we will use the below pojo objects Employee package package2; import java.math.BigDecimal; import java.util.List; public class Employee { private String id; private String name;…… Continue reading UnMarshalling YAML file to Java Object
Category: YAML
Marshalling Java Object to YAML format
This post explains marshalling a java object to YAML format and storing it to a file. This can be achieved with the help of YAMLMapper provided by jackson package. To explain with an example we will use the below pojo objects. Employee package package2; import java.math.BigDecimal; import java.util.List; public class Employee { private String id;…… Continue reading Marshalling Java Object to YAML format
Creating a YAML file
The below post explains how to write YAML data to file using YAMLGenerator. YAMLGenerator writes the data to a file in streaming way, helping the developer using the api to avoid creating an object representation of the entire data. We can get an instance of YAMLGenerator with the help of an instance of YAMLFactory as…… Continue reading Creating a YAML file
Parsing a YAML file
In this post I will explain how to parse a YAML file using Jackson framework. We need the following jars in our classpath 1) jackson-dataformat-yaml-2.9.6.jar 2) snakeyaml-1.18.jar 3) jackson-annotations-2.9.0.jar 4) jackson-core-2.9.6.jar 5) jackson-databind-2.9.6.jar First we need to create an instance of YAMLFactory class. It is factory class used to create instance of YAMLParser (reader) and…… Continue reading Parsing a YAML file