[sf-perl] Slightly OT: Freebase User Group meeting next Weds
Quinn Weaver
quinn at fairpath.com
Sat Sep 15 00:13:27 PDT 2007
On Fri, Sep 14, 2007 at 11:35:16PM -0700, Randal L. Schwartz wrote:
> >>>>> "Quinn" == Quinn Weaver <quinn at fairpath.com> writes:
>
> >> Well, it's more like a subset of YAML, but it's the subset that I tend
> >> to use, so that's OK with me.
>
> I don't know who started the "JSON is YAML" meme, but it's clearly gotten
> far too much legs to be the right thing.
My guess is it came from here:
http://redhanded.hobix.com/inspect/yamlIsJson.html
> *IF* you write your JSON in the right way, a YAML parser can parse it.
Yes, though "the right way" just means no /* C-style comments */ .
Modulo those, JSON is just a subset of YAML, right?
> Good luck getting a YAML writer to *write* JSON.
I'm not sure I understand. By "YAML writer", do you mean a human who
is manually producing JSON, but who is more used to YAML? I agree, I
wouldn't expect to get someone like that to get it right.
But I think of JSON more as a way for machines to dump data structures.
You have some structure on the server side, and you want to serialize it
for the client, so you do
my $output = data2json(); # probably produces no /* comments! */
And $output is what the client sees.
Now, "the client" can be either A) your own web pages' client-side AJAX[1], or
B) some third-party code that is using your site as a web service. Both can
use the same API. If B relies on a YAML parser (say, because the language
has no good JSON-only parser), it will still work. That's what I think is cool.
Does that make sense? Or are we talking at cross purposes? Anyway, thanks
for contributing to our list. I'm glad to have you here. :)
--
Quinn Weaver, independent contractor | President, San Francisco Perl Mongers
http://fairpath.com/quinn/resume/ | http://sf.pm.org/
510-520-5217
More information about the SanFrancisco-pm
mailing list