Hacker News new | ask | show | jobs
by sneak 2270 days ago
Please stop using json for config files. Config files that cannot be commented are terrible for maintainability.

Everything that can read json has the ability to read yaml. Please use yaml instead.

5 comments

Prefer toml over yaml. Large Yaml files are a nightmare to edit with all the special spacing. JSON might be comment unfriendly but it is easily editable.

They just need to have a version of JSON with comments: JSONC and JSON is good.

As a heavy YAML user for a while (writing and maintaining Open API Spec files), YAML is also a catastrophe. I should not have to "debug" a config file because some tiny whitespace issue is off.

JSON as config isn't good, but YAML is not a silver bullet.

Definitely agree that YAML is not a silver bullet. One thing that I’ve found to improve my YAML editing experience is to use a YAML language server [1] backed by JSON schemas. It provides a real time feedback cycle rather than handing the file off to another program to choke cryptically.

[1] https://github.com/redhat-developer/vscode-yaml/blob/master/...

I agree that config is quite weak in Goyave. I planned to rework it in a later major version. But I don't want to release breaking changes one by one.
JSON5 supports comments. NET Core has been working with comments inside .json appsettings files for a very long time now.
json5 is a neat idea, but if you’re going to use a serialization format that isn’t json, yaml is the way to go, despite its known minor inconveniences. Everything can read json and yaml. Not much can read json5.
This is just your arbitrary hobbyhorse opinion about something yet you're saying it with an absoluteness that doesn't make me think you realize that.