[Discuss] Application config files

Derek Martin invalid at pizzashack.org
Mon Jul 22 16:33:20 EDT 2019


On Fri, Jul 12, 2019 at 06:10:21PM -0400, Rich Pieri wrote:
> On Fri, 12 Jul 2019 16:16:15 -0500
> Derek Martin <invalid at pizzashack.org> wrote:
> 
> > I largely disagree.  If it's currently in INI format the equivalent
> > JSON should generally be perfectly human-readable, e.g.:
> 
> Computer-generated JSON can be human-readable. Doesn't mean it will be.
> Often enough it is not. Very not. For example, my Calibre metadata
[...]
> Admittedly that cache isn't easily stored in simple key/value pairs
> because it's not simple key/value data like your example.

But an .ini file (what we were discussing) IS easily stored in simple
key/value pairs, because that's exactly what it is.  We were also
talking about Python, and it's easy enough to GUARANTEE that such a
simple structure  is printed readibly:

>>> import json
>>> print json.dumps({'4': 5, '6': 7}, sort_keys=True,
...                  indent=4, separators=(',', ': '))
{
    "4": 5,
    "6": 7
}

On Sat, Jul 13, 2019 at 08:14:37PM -0400, Steve Litt wrote:
> Your assertions (not copied here) about Python writing beautful
> json is true, but humans, not so much. One could easily write a Python
> json beautifier to help, but I still think complex json is hard for a
> human to edit.

But we're not talking about complex JSON, we're talking about INI file
key-value pairs, converted to (pretty much necessarily) simple JSON.
Regardless of who's writing it, you'd probably have to go out of your
way to make it unreadable, and FWIW on the read end the parser won't
care as long as it parses.

With those constraints--which were explicitly stated--using JSON is
perfectly suitable, and will take almost no time to implement.

-- 
Derek D. Martin    http://www.pizzashack.org/   GPG Key ID: 0xDFBEAD02
-=-=-=-=-
This message is posted from an invalid address.  Replying to it will result in
undeliverable mail due to spam prevention.  Sorry for the inconvenience.



More information about the Discuss mailing list