YAML
is a human friendly data serialization standard for all programming languages.
YAML
shows the data in very clean way, by minimizing the amount of structural
characters.
For
example,
a.
indentation
is used for structure,
b.
colons
separate key: value pairs, and
c.
dashes
are used to create lists.
Don’t use tabs for
indentation
Tabs
have been outlawed since they are treated differently by different editors and
tools, and since indentation is so critical to proper interpretation of YAML,
YAML forbid tabs.
What is the file
extension of yaml files?
.yaml,
.yml
Is YAML a markup
language?
No
Is YAML case
sensitive?
Yes
Where is YAML used?
YAML
was designed to work with below use cases.
a. configuration files,
b. log files,
c. inter process
messaging,
d. cross-language data
sharing,
e. object persistence,
and
f. debugging of complex data
structures
For
example, log4j2 supports yaml configuration file.
Configuration: status: warn name: YAMLConfigTest properties: property: name: filename value: target/test-yaml.log thresholdFilter: level: debug appenders: Console: name: STDOUT PatternLayout: Pattern: "%m%n" File: name: File fileName: ${filename} PatternLayout: Pattern: "%d %p %C{1.} [%t] %m%n" Filters: ThresholdFilter: level: error Loggers: logger: - name: org.apache.logging.log4j.test1 level: debug additivity: false ThreadContextMapFilter: KeyValuePair: key: test value: 123 AppenderRef: ref: STDOUT - name: org.apache.logging.log4j.test2 level: debug additivity: false AppenderRef: ref: File Root: level: error AppenderRef: ref: STDOUT
Simple
yaml file in eclipse is rendered like below.
How to validate yaml
data online?
You can use above website to validate your yaml data.
Can I import one YAML
file into other?
No,
YAML does not support any kind of "import" or "include"
statement.
I
am going to use below maven dependencies throughout this tutorial.
<dependencies> <!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.dataformat/jackson-dataformat-yaml --> <dependency> <groupId>com.fasterxml.jackson.dataformat</groupId> <artifactId>jackson-dataformat-yaml</artifactId> <version>2.9.5</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> <version>2.9.5</version> </dependency> </dependencies>
No comments:
Post a Comment