airbnb/synapse — pull request #26 by memory (2013-11-15 20:41:20+00:00)
Title: use YAML rather than JSON for configuration files

JSON is an excellent tool for simple data interchange between servers,
but is a royal pain as a configuration file format which must also be
written and read by human beings. The difference between valid and
invalid JSON is often down to a single character in hard-to-spot places:

{ "valid_json?":
{ "lets":
["play",
"spot",
"the",
"syntax",
"errors",
]
},
}

(It gets even worse if you want to _generate_ valid JSON in the context
of, say, an ERB/moustache template file: ugly logic must be invoked to
make sure that lists are terminated correctly.)

Even worse: correct JSON does not allow for comments. And while you can
certainly do:

{ "this_dict": {
"has": "values",
"and": "a",
"comment": "which is me!" }
}

...it's much harder to do something like this:

{ "this_dict": {
# TODO: restore when bug #7 closes
# "has": "values",
# "and": "a",
"comment": "which is me!" }
}

...whereas all of the above strings are valid and correct YAML.