I think XML has been thoroughly explained by the others. However, YAML and JSON are both elegant languages, and they are not as similar as you might believe at first glance.
Some of the particularities about YAML
References
- person: &id002
name: James
age: 5.0
- person: *id001
The second person is an associative array equal to the first.
Casting data types
foobar: !!str 123
foobar is "123" (type string).
Uncommon data types not supported by every implementation
Wikipedia:
Particularly interesting ones [...] are sets, ordered maps, timestamps, and hexadecimal.
Therefore, I consider JSON a lot simpler.
An argument for JSON
Not just for JavaScript
While it might seem stupid to use the "JavaScript Object Notation" for your application if you don't use JavaScript, you should really consider it anyway, because the data types offered in JSON are probably the most common ones in your language too.
Readable, even if the whitespace is optional
I think JSON is very readable once prettified, which is very easy to do. YAML is difficult to make compact, since it relies on the whitespace. Granted, you should rely on compression for saving bandwidth. The references in YAML might save you a few bytes, but they add a lot of complexity. If you are really dealing with amounts of data that makes it important to avoid duplication, I'd suggest solving that problem on a whole other level. Not even XML supports these kind of macros.