Replies: 3 comments 2 replies
-
|
I understand the desire for this feature, but I'm wary of it, because it breaks the JSON specification. So, suddenly all your configuration files won't be able to load in tons of JSON libraries and won't pass JSON validators. I don't think breaking the specification is worth the slight benefit. Instead, I would recommend using a tool like VSCode to edit JSON files, so that it will syntax highlight your errors. Other editors will provide this feedback as well. Also, trailing comma support would actually make parsing a little slower, because it adds another branch in parsing arrays. If you want a more human friendly configuration format then I would recommend TOML, which Glaze also supports. I'm open to hear your thoughts, feel free to comment below, but I'm going to close this issue for the reasons stated above. |
Beta Was this translation helpful? Give feedback.
-
|
Yeah, I understand the reasons behind the fact it's not a default, but like comments, I think it is something that you may still want under some circumstances. As far as I know JSONC has the same shortcomings as this does, you can't parse it using non JSONC compliant parsers, and most parsers will reject it by default That is why I think it could be an option that has to be explicitly specified. I know about TOML, but it falls short when dealing with configuration files that have a lot of nesting, even with toml 1.1 multiline inline tables. |
Beta Was this translation helpful? Give feedback.
-
|
@aurelleb, I've moved this to discussions so more developers can find this and provide feedback. Your argument about JSONC is good, but I feel it adds much more benefit than trailing commas, and it is supported as a standard by a number of tools. You're correct about TOML and complex/nested structures. I do prefer JSON for configuration. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
One of my use case for glaze is to load configuration files that can sometimes be hand edited, and a very common mistake when hand editing is to forget a trailing comma after rearranging an object.
It would be great if glz::opts could add an option to ignore such trailing commas
Beta Was this translation helpful? Give feedback.
All reactions