5 ms·
I wish it had comments. And for that reason, I prefer yaml.
by guideamigo 3y ago
I wish it had comments.
And for that reason, I prefer yaml.
- WirelessGigabit 3y agoI prefer JSON's strictness. A Boolean cannot be confused for a string. In yaml: country: no Now your country is Boolean(false) Now, I still prefer yaml overall. Also, I hate that GitHub actions don't support anchors.
- wyldfire 3y agoThat's a false dichotomy. JSON could have comments and not be ambiguous like YAML. In fact: there exists a specification called JSON5 which does include comments. But I agree that it would've been nice if it had comments before it achieved a critical mass of adoption.
- squeaky-clean 3y agoI don't think they were saying that's an issue of comments, just an issue of yaml vs json.
- euroderf 3y agoI've read the opinion that comments were omitted from JSON in order to forestall hacky round-trip conversions to/from other formats (like XML). Can anyone confirm/deny ?
- mediumsmart 3y agoThe primary reason why JSON does not support comments is that its creator, Douglas Crockford, deliberately removed them from the format to prevent misuse and keep it as a pure data-only format. Crockford observed that some people were using comments to store parsing directives, which could break compatibility between different systems. Hence, the decision to remove comments to maintain the simplicity and consistency of the format across various programming languages and environments. https://www.freecodecamp.org/news/comments-in-json/ https://www.freecodecamp.org/news/comments-in-json/ I vote for the minimalist heretic. https://www.infoq.com/presentations/Heretical-Open-Source/ https://www.infoq.com/presentations/Heretical-Open-Source/
- mminer237 3y agoIn YAML 1.2 that gives the string "no".
- 8organicbits 3y agoHuh, that's a breaking change. yes/y/no/n/on/off are no longer boolean. https://perlpunk.github.io/yaml-test-schema/schemas.html https://perlpunk.github.io/yaml-test-schema/schemas.html
- milliams 3y agoYes, it it. However, it's a breaking change that happened 14 years ago.
- masklinn 3y agoExcept for many yaml implementations either not supporting 1.2 at all (pyyaml, ruby stdlib) or being a weird mix (goyaml) so as to keep working with older files. So when you’re dealing with objective reality, this is still an issue today.
- manojlds 3y agoSo that's been the spec since 2009???
- riwsky 3y agocries in TOML
- guideamigo 3y agoThis is the only example everyone points out against yaml. For Json, there are several such syntactic problems. Unnecessary double quotes and only double quotes everywhere. No dangling comma.
- msm_ 3y agoThese are different kinds of problems. JSON is (arguably) too strict. YAML is (arguably) too loose. One is better for machines, the other is (usually) better for writing by humans by hand. There's no perfect compromise for every use case.
- kondro 3y agoThere’s always JSON5
- Defletter 3y agoTrue, but the multi-line comments give me the ick, and there's still no standard for bigints.
- hackerbrother 3y agoYAML is a fine implementation of JSON with comments.