Simon Willison’s Weblog

YAML

I forget quite how I got there, but the other day I found myself reading about YAMLYAML Ain’t Markup Language. It looks really interesting. YAML aims to be an easily human readable format for storing and trasferring structurered data—so far, so XML. Where it differs from the IT world’s favourite buzzword is that YAML is specifically designed to handle the three most common data structures—scalars (single values), lists and dictionaries. Here’s a sample (taken from the official specification):

Time: 2001-11-23 15:01:42 -05:00
User: ed
Warning: >
  This is an error message
  for the log file

YAML has a number of obvious influences, including Python and MIME. Implementations already exist for Perl, Python and Java. XML-RPC aptly demonstrates how powerful the combination of lists, dictionaries and arrays can be for exchanging data between different systems and YAML looks like it offers a very nice alternative to XML based data structure syntax. I have to admit to being slightly concerned by the length of the specification—while YAML is definitely human readable it looks like it could take a while for a human to learn to write it. Then again, the actual generation of the format is meant to be handled by computers (I imagine that humans will make simple edits to YAML files more often than they create them from scratch) so the complexity of the more advanced parts of the specification is probably not too much of a problem.

This is YAML by Simon Willison, posted on 5th December 2002.

Next: Java interfaces explained

Previous: Remembering passwords

Previously hosted at http://simon.incutio.com/archive/2002/12/05/yaml