Re: Basic JSON support

From: Itagaki Takahiro <itagaki(dot)takahiro(at)gmail(dot)com>
To: Joseph Adams <joeyadams3(dot)14159(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Basic JSON support
Date: 2010-09-21 12:38:03
Message-ID: AANLkTimg7qEzVLjjREQuEewpiwWhbCAf8oBVemmWSTfr@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Sep 20, 2010 at 1:38 PM, Joseph Adams
<joeyadams3(dot)14159(at)gmail(dot)com> wrote:
> I have written a patch that amends the basic_json-20100915.patch .

Thanks. I merged your patch and added json_to_array(), as a demonstration
of json_stringify(). As the current code, json_stringify(json) just returns
the input text as-is, but json_stringify(json, NULL) trims all of unnecessary
whitespaces. We could do it in json_in() and json_parse() and always store
values in compressed representation instead. We leave room for discussion.

I also merge json_test_strings.sql into the main test file.
I slimed some tests -- many test cases seem to be duplicated for me.

> I went ahead and added json_validate() now because it's useful for
> testing (my test strings use it).

Good idea, but how about calling it json_is_well_formed()? We have
similar name of functions for xml type. I renamed it in the patch.

> Here's one thing I'm worried about: the bison/flex code in your patch
> looks rather similar to the code in
> http://www.jsonlint.com/bin/jsonval.tgz , which is licensed under the
> GPL.  In particular, the incorrect number regex I discussed above can
> also be found in jsonval verbatim.  However, because there are a lot
> of differences in both the bison and flex code now,  I'm not sure
> they're close enough to be "copied", but I am not a lawyer.  It might
> be a good idea to contact Ben Spencer and ask him for permission to
> license our modified version of the code under PostgreSQL's more
> relaxed license, just to be on the safe side.

Sorry for my insincere manner. Surely I read his code.
Do you know his contact address? I cannot find it...

--
Itagaki Takahiro

Attachment Content-Type Size
basic_json-20100921.patch application/octet-stream 36.6 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2010-09-21 12:54:27 Re: Basic JSON support
Previous Message Magnus Hagander 2010-09-21 12:12:33 Re: .gitignore files, take two