7 ms·
the only thing I miss are the comments
by dickeytk 7y ago
the only thing I miss are the comments
- westurner 7y agoJSON5 supports comments: https://json5.org/ https://json5.org/
- throwaway894345 7y agoBut who supports json5?
- hombre_fatal 7y agoYou can use json5 for comments and compile it to json.
- CameronNemo 7y agoYou can use (yaml, hjson, jsonnet) for the same purpose. What sets json 5 apart?
- Supermancho 7y agoYAML, hjson and jsonnet do not validate existing json blobs. You can "use" ROT13 for the same purpose, but it's incidental in what you are trying to do. I would plead that everyone stop using YAML. It's terrible at everything. jsonnet is a template language for a serialization format. Who would choose that nightmare? Ecmascript isn't big on extending the language orthogonally, so hjson is eventually going to be superceded by a ES*. This is a niche concern that has an optimal path. Go with a validation schema designed for applying to a serialization format, which has widespread library support.
- CameronNemo 7y ago>YAML ... do not validate existing json blobs YAML 1.2 is a strict superset of JSON. What do you mean by "validate" here? >I would plead that everyone stop using YAML. It's terrible at everything. Fair enough. >jsonnet is a template language for a serialization format. Who would choose that nightmare? People who are tired of Jinja2 and YAML but don't want to jump to a general purpose programming language? >widespread library support JSON5 is implemented in Javascript, Go, and C#. Not sure how "widespread" that is. Rust, C, Python, Lua, Java, and Haskell are missing out on the fun.
- westurner 7y agoWhen I searched for "JSON5 [language]", I found JSON5 implementations in/for Rust, C, Python, Java, and Haskell on the first page of search results. I like YAML, but some of the syntax conveniences are gotchas: 'no' must be quoted, for example.
- kevinoid 7y agoThen you may be happy to learn that OpenAPI documents can be written in YAML (since OpenAPI 2.0).
- dvh 7y agoIf there were comments, people would start putting data in comments.
- dickeytk 7y agobut for that you'd have to use a custom parser. If you use a custom parser you could put data in comments today anyways. I don't understand that argument.
- tasogare 7y agoAttributes are also super nice to extend existing data. Doing so in JSON is a nightmare.