News for hackers. Stuff that matters.
Re:YAML: probably not so great after all (2017) by Zamicol on Wednesday June 20, 2018 @03:12PM (#17358692)
>Suppose you are using JSON to keep configuration files, which you would like to annotate. Go ahead and insert all the comments you like. Then pipe it through JSMin before handing it to your JSON parser.

-Douglas Crockford, creator of JSON

There is no issue using JSON with comments for a config file.

Re:YAML: probably not so great after all (2017) by artpepper2 on Wednesday June 20, 2018 @03:20PM (#17358790)
Blurg, now every tooling pipeline that uses JSON needs to include a JSMin step...
Re:YAML: probably not so great after all (2017) by Zamicol on Wednesday June 20, 2018 @03:33PM (#17358901)
If you're making comments for yourself in config files you control:

/\/\/.*/gm

https://regexr.com/3rbgb

Re:YAML: probably not so great after all (2017) by lolc on Wednesday June 20, 2018 @06:33PM (#17360457)
"hello // syntax error"
Re:YAML: probably not so great after all (2017) by Zamicol on Thursday June 21, 2018 @02:24PM (#17367925)
You are 100% correct. For not single line comments, "//" in the datastructure, and everything else there are already well tested solutions for the problem. https://github.com/sindresorhus/strip-json-comments

My point is only that this isn't a big issue. I don't understand why so many see it as a large issue. Instead, projects use non-standard YAML or other problematic solutions only because "JSON doesn't have comments".

Re:YAML: probably not so great after all (2017) by ngrilly on Wednesday June 20, 2018 @03:15PM (#17358732)
Yes, except for the fact that ECMAScript has a syntax for comments, but not JSON. Standards matter.
Re:YAML: probably not so great after all (2017) by always_good on Wednesday June 20, 2018 @03:13PM (#17358704)
Or pipe through json5 which has other conveniences one might want like trailing commas.
Re:YAML: probably not so great after all (2017) by Zamicol on Wednesday June 20, 2018 @03:16PM (#17358741)
I love json5, but it's not always an option.
Re:YAML: probably not so great after all (2017) by always_good on Wednesday June 20, 2018 @03:28PM (#17358853)
Yes, but ITT we're talking about someone apparently having the option to pick which format they're using for config, and they'd use JSON if it wasn't for one dealbreaker.