I'm writing a new C# application which will make heavy use of a configuration file. My requirements are:
- Human readable
- Name value pairs
- Hierarchical
- [Updatable by application]
Um, to translate: I want to define an object and a set of configuration parameters associated with that object. The configuration parameters may be name value pairs or another object, with it's own attributes attached:
module "db" { host: "db.example.com"; encoder "zip" { compression: 10; } }
I'm less committed to requirement 4, but do consider that I would like the application to update a setting and write it back to the configuration file.
I am aware of the following options:
- XML. Not sufficiently human readable.
- INI file. Not hierarchal
- JSON.
- YAML.
JSON and YAML seem worth investigating.
Advise on using these for configuration? Any alternate tools I may want to consider?
As for persisting changes made by the application back to the config file I know that JSON and YAML can do this but can either do this WHILE saving comments which may have been in the original human edited version?