I have a small tool I'm designing which would require a configuration file of some sort. The configuration file in my case is really more of a database, but it needs to be lightweight, and if needed the end-user should find it easily editable. However, it also will contain a lot of things in it. (depending on certain factors, could be 1Mb or more)
I've decided I'd rather use plain ol' text, rather than trying to use SQLite or some such. However, with using text, I also have to deal with the variety of formats. So far, my options are
- Custom format
The data in my file is quite simple consisting for the most part of key-value type things. So, a custom format wouldn't be that difficult... but I'd rather not have to worry about writing the support for it. I've never seen JSON used for configuration files. And XML would bloat the file size substantially I think. (I also just has a dislike of XML in general).
What should I do in this case?
Factors to consider:
- This configuration file can be uploaded to a web service(so size matters)
- Users must be able to edit it by hand if necessary(ease of editing and reading matters)
- Must be able to generate and process automatically (speed doesn't matter a lot, but not excessively slow)
- The "keys" and "values" are plain strings, but must be escaped because they can contain anything. (unicode and escaping has to work easily)
- Multiple configuration files. Basically, each config file is tied to one "project"