Re: JSON as a subset of YAML, closing the last caveat
"Clark C. Evans" <[email protected]>
| Newsgroups | gmane.text.yaml.general |
|---|---|
| Message-ID | <[email protected]> |
Michael, Thank you for your detailed email. According to the JSON specification, at http://www.json.org/, and also RFC 4627, there are no comment structures in JSON. I'm open to including // and /* */ comments if Oren Ben-Kiki and Kirill Simonov think it would be relatively painless to do, however, I'm not sure this would be particularly easy. That said, Oren has been working on some production cleanups to handle some of the more subtle differences, and Kirill's implementaion (libyaml, PyYaml, and its derivatives) at the current moment treats inconsistences between the specifications as an error condition. We really do need a new spec release (like last year), it's just been extremly hard to find time. Best, Clark On Tue, Aug 07, 2007 at 06:09:08PM -0700, Michael G Schwern wrote: | As most of you are probably aware, JSON is an accidental subset of YAML. | http://redhanded.hobix.com/inspect/yamlIsJson.html | | This is very handy to shut down YAML vs JSON format wars. Which should the | project accept? Use a YAML parser and accept both! | | But there's one important caveat: The comments. JSON comments (C++ style // | and /* */) are not valid YAML comments. Any JSON document must first be | stripped of its comments before it can be considered YAML. This is annoying. | It would be very nice to hang out a "We accept JSON and YAML" shingle with no | practical caveats. YAML can then strap itself onto JSON's popularity. | | Some might say "but comments are just presentation, they don't have any effect | on the data", and while that is true they are still useful, and people write | them and it remains an obstacle to JSON/YAML interchange. | | What's to be done? I see several levels. | | 1) Ignore it. | | 2) Individual YAML parser authors hack in support for JSON comments, | possibly with a switch to turn it on and off. | | 3) The YAML spec contains a suggestion that YAML parsers handle JSON | comments complete with a suggested grammar. | | 4) The YAML spec be amended to accept JSON single-line comments (//) which | are already very similar to YAML comments. | | 5) The YAML spec be amended to accept both JSON single and multi-line (/* */) | comments. | | Its such a small change to make YAML a complete superset of JSON, seems like | it would be worth it to take some action to close the gap. | | | (NOTE: to clarify I'm not saying to get rid of YAML's existing comments). | | | ------------------------------------------------------------------------- | This SF.net email is sponsored by: Splunk Inc. | Still grepping through log files to find problems? Stop. | Now Search log events and configuration files using AJAX and a browser. | Download your FREE copy of Splunk now >> http://get.splunk.com/ | _______________________________________________ | Yaml-core mailing list | [email protected] | https://lists.sourceforge.net/lists/listinfo/yaml-core | ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/