Re: ypaste: json compatiblity?
Oren Ben-Kiki <[email protected]>
| Newsgroups | gmane.text.yaml.general |
|---|---|
| Message-ID | <1178851782.25277.69.camel@nero> |
On Thu, 2007-05-10 at 14:17 -0700, Burt Harris wrote:
> Have the productions used by ypaste at dev.yaml.org been updated for json
> compatabillity?
Yes, they have.
> Here's the tricky one I tried:
>
> {1:"Two"}
>
> Note that there is no space following the colon. I believe json would parse
> this with a key of (int)1, and a value of "Two".
Nope. JSON only allows for (double quoted) string keys. *JavaScript*
would parse it, but then again JavaScript would parse a lot of non-JSON
stuff.
This should definitely go into the spec as an example!
> YPaste parsed it as a key
> of '1:"Two"', and an empty value.
As it should. Think or the value http://www.yaml.org - which YAML allows
to be unquoted. We only allow skipping the ' ' following the ':' if the
key is quoted. Another way to think about it is that YAML tries its
utmost to interpret things as plain scalars and only chops them into
key/value pairs if there is no other way to read input.
Keep up the good work,
Oren Ben-Kiki
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/