.yaml, .toml, etc?

21 points

I usually use Json5. It’s JSON, but with all the weird quirks fixed (comments added, you can use hex numbers, you can have trailing commas etc.)

permalink
report
reply
3 points

Oh that’s interesting. Wonder how many libraries out there support it…

permalink
report
parent
reply
1 point

I don’t know if it’s actual json5, but eslint and some other libraries use extended, commentable json in their config files.

permalink
report
parent
reply
16 points

A lot of good answers but I would add one note:

  • use a format that supports comments, and JSON is not one of those…
permalink
report
reply
12 points
*
Deleted by creator
permalink
report
parent
reply
17 points

You disgust me

permalink
report
parent
reply
1 point

This is actually pretty genius, why haven’t ever thought of that?

permalink
report
parent
reply
1 point
*
Deleted by creator
permalink
report
parent
reply
1 point

How do you comment multiple properties separately?

permalink
report
parent
reply
2 points
*
Deleted by creator
permalink
report
parent
reply

I believe the JSON deserializer .NET ships with has options to allow C#-style comments in JSON files.

permalink
report
parent
reply
2 points

JSON5 is a superset of JSON that supports comments.

permalink
report
parent
reply
1 point

json with comments can be parsed by a yaml parser. It’s how I write yaml, in fact (yaml is a superset of json. any valid json is valid yaml, but it also supports comments)

permalink
report
parent
reply
16 points

JSON by a mile. I hate the YAML plague, it’s some of the most unintuitive syntax I’ve seen and yet it’s everywhere in DevOps/SysOps.

permalink
report
reply
9 points

The only thing that really annoys me about JSON is that it doesn’t allow comments.

permalink
report
parent
reply
9 points

JSON5, bay-beee

permalink
report
parent
reply
6 points

GitHub Actions and Azure DevOps had me hating on YAML pretty quickly

permalink
report
parent
reply
4 points

Yeah, any language in which whitespace count is semantically significant can go suck fat nards.

permalink
report
parent
reply
8 points

Not sure whether fantastic troll or just no exposure to Python.

Either way…I’m here for it.

permalink
report
parent
reply
8 points

Neither, I’ve written plenty of Python and I know how useful it can be. However, as someone who is neurospicy, I find languages that have semantically l significant white space to be frustrating to read.

Sure, there are tools to help with it. Sure, they help. But they don’t replace how much more useful curly braces are at defining scope.

permalink
report
parent
reply
8 points

I mean, a valid JSON is a valid YAML

permalink
report
parent
reply
6 points

I hate that you’re correct lmao

permalink
report
parent
reply
1 point

YAML works better with git than JSON, but so much config work is copy and pasting and YAML is horrible at that.

Having something where changing one line doesn’t turn into changing three lines, but you could also copy it off a website would be great.

permalink
report
parent
reply
14 points

It depends what you need your configuration file to be:

Need a well defined easy to understand concrete configuration file?

  • Use .toml. It was made to be both human and computer friendly while taking special attention to avoid the pitfalls commonly found in other configuration files by explicitly stating expected types around commonly confused areas.

Need a simple to implement configuration file?

  • Use .json. It’s famous for being so simple it’s creator “discoverer” could define it on a business card.

Need an abstract configuration file for more complicated setups?

  • Use .ncl. Nickle allows you to define functions so that you can generate/compute the correct configuration by changing a few variables/flags.
permalink
report
reply
13 points

.ini

ducks

permalink
report
reply
2 points

Give the windows registry a shot.

permalink
report
parent
reply

Experienced Devs

!experienced_devs@programming.dev

Create post

A community for discussion amongst professional software developers.

Posts should be relevant to those well into their careers.

For those looking to break into the industry, are hustling for their first job, or have just started their career and are looking for advice, check out:

Community stats

  • 11

    Monthly active users

  • 77

    Posts

  • 540

    Comments