Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Current »

Yaml is a straightforward machine parsable data serialization format designed for human readability and interaction with scripting languages. One of its reasons for popularity is that XML can sometimes be quite verbose and cumbersome. Groovy's XML capabilities make XML less verbose (e.g. through its builder notation for creating XML) and less cumbersome (e.g. its excellent XML processing capabilities). Even so, there may be times when you need to or prefer to use Yaml over XML. Here are some examples of how to use Groovy with the JYaml library.

First, reading simple lists:

Reading maps:

Reading into classes:

Writing lists:

This produces:

---
- "a, b"
- 123456
  • No labels