{
"subject": "Re: JSON-RPC password",
"content": {
"format": "html",
"body": "<div class=\"post\">I was researching config file formats, here's a comparison.<br/><br/>YAML is massive. I'm not sure there's a lightweight easy to build library we can integrate into our project. Seems overkill.<br/><br/>JSON is tempting and I'm inclined to like it, but two main sticking points:<br/>1) No comments! How can you have a config file where you can't comment out a line to disable it?<br/>2) Not very user friendly to have to \"quote\" all the strings, including the keys, and also have to remember the comma at the end of lines.<br/>{<br/> \"key\" : \"value\",<br/>}<br/><br/>I suppose we could easily preprocess JSON reading the config file one line at a time, truncate the lines at any # character (and/or \"//\"?), concatenate them into a string and pass it to JSON, so you could go:<br/># comment<br/>\"key\" : \"value\", # still have to remember the comma <br/>\"key2\" : \"value\", // comment like this or both<br/><br/>Boost has boost::program_options.<br/><br/>We could read lines ourselves and feed them into a map<string, string> mapConfig.<br/><br/>while (!eof)<br/> read line<br/> if '#' found, truncate line<br/> split line at first ':' -> key, value<br/> mapConfig.insert(key, value)<br/><br/>If we use the syntax:<br/># comment<br/>key : value<br/><br/>...and don't allow whitespace indenting before the keys, I guess we would be a subset of YAML and could switch to YAML someday if we need more complexity. <br/><br/>If we go with self parsed, that doesn't mean we can't use JSON on particular parameter values as needed. If an option needs a list or more structured data, it could always parse its value as json:<br/>key : [\"item1\", \"item2\", \"item3\"]<br/><br/>Although it has to be all on one line then.<br/><br/>I guess I'm leaning towards self parsed mapConfig:<br/># comment<br/>key : value<br/></div>"
},
"source": {
"name": "Bitcoin Forum",
"url": "https://bitcointalk.org/index.php?topic=461.msg4646#msg4646"
},
"date": "2010-07-21T05:51:34Z"
}