Get a high-level introduction to the YAML file format for Java developers. Find out how it differs from XML and JSON and examine its relative advantages and drawbacks.
by Jacek Furmankiewicz
July 2, 2008
espite all the buzz generated by dynamic languages (Ruby, Groovy, Python, etc.) and their related frameworks (such as Ruby on Rails), the vast majority of Java developers reading this article deal mostly with pure Java at their day jobs and will continue to do so for many years to come. However, that doesn't mean that they can't learn something from the new kids on the block and add a new tool to their arsenals. This article introduces the YAML (short for YAML Ain't Markup Language) file format (popularized by the Ruby on Rails framework, which uses YAML for all of its configuration files) and shows how it differs from XML and JSON. It goes on to examine YAML's advantages and drawbacks.
Whitespace Indentation and the JSON Option
The YAML file format is centered on the concept of whitespace indentation, which is used to indicate the hierarchical structure of datainstead of nested XML tags or JSON braces ({}) and brackets ([]). It is, however, a superset of JSON. So when it is useful, you may break out of the whitespace flow and adopt a typical JSON-style syntax. Its creators describe it as a "human-friendly data serialization standard for all programming languages." In my experience, its focus on "human-friendliness" is what sets it apart.
It's quick, easy and you get access to all the articles on DevX.
This registration/login is to allow you to read articles on devx.com. Already a member?
To become a member of DevX.com create your Member Profile by completing the form below. Membership is free!