News for hackers. Stuff that matters.
Re:YAML and Configuration Files by MichaelMoser123 on Saturday August 14, 2021 @09:02PM (#28185328)
you could allow python like comments and strip them with a regular expression substitution before parsing. Something like this. (it strips all the lines that start with whitespace, followed by #, followed by anything until the end of the line)

   cat cfg.json | sed -e 's/\s*#.*$//g' | jq .
Allowing multiple lines is more complicated, can't do that with regex alone.
Re:YAML and Configuration Files by brundolf on Saturday August 14, 2021 @09:33PM (#28185478)
There are lots of ways to implement it. The problem is that one of JSON's strengths is its ubiquity: every language under the sun has half a dozen different battle-tested parsers for it. Clients and servers and everything in-between have first-class support out of the box. You can even paste it directly into JavaScript as valid code.

If anybody short of a standards body tries to expand the spec, you lose out on most of that.

Re:YAML and Configuration Files by MichaelMoser123 on Saturday August 14, 2021 @11:04PM (#28185943)
i think you can possibly define how you want to use json for a configuration file; json by itself is not much more than javascript objects/maps, defined as a data format. I frankly don't think that you need to be too pious about standard compliance if dealing with a cofiguration format for your application.
Re:YAML and Configuration Files by SigmundA on Monday August 16, 2021 @11:34AM (#28199280)
>json by itself is not much more than javascript objects/maps

And without comments or optional quoted keys single quotes or trailing commas, which makes editing by hand more work and IMO less readable.

Re:YAML and Configuration Files by brundolf on Sunday August 15, 2021 @12:42AM (#28186319)
Editors, for one, will be an issue