From: William S. <sp...@rh...> - 2010-08-26 02:13:17
|
Kirill Simonov wrote: > By unquoted JSON, do you mean something like: > {foo:"bar"} Yes, though {foo: "bar"} is probably a better example (note the space!) > This is definitely not a valid JSON and I'm certain most of the JSON > parsers will fail to parse it. However there are a lot of pseudo-JSON parsers that *do* parse it, including libyaml itself! The problem is that except for libyaml, every single parser I know of that can read the version with the space will also read the version without the space. This is a very rude suprise to users who will logically think that yaml reads a superset of some definition they are familiar with. It can "sort of" read unquoted JSON, but not all the files. At least the current version produced an error, so the user knows something went wrong (although I had to pretty quickly patch it and remove the test because I encountered so many files that would not read). But if you change it to silently produce unexpected results I think it will be a disaster! If the concern is for typing url data in, I would just change the rules for colon for an unquoted scaler depending on whether a key or value is being read in. You could even allow following spaces. The following: {foo:http:baz: zoo} would be interpreted as: {"foo" : "http:baz: zoo") It would seem that such a design is much more in keeping with the style of YAML. |