From: | Petr Jelinek <pjmodos(at)pjmodos(dot)net> |
---|---|
To: | Joseph Adams <joeyadams3(dot)14159(at)gmail(dot)com> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Proposal: Add JSON support |
Date: | 2010-04-06 05:00:59 |
Message-ID: | 4BBAC00B.4000801@pjmodos.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Dne 6.4.2010 5:50, Joseph Adams napsal(a):
> Another JSON strictness issue: the JSON standard (
> http://www.ietf.org/rfc/rfc4627.txt ) states that JSON text can only
> be an array or object. However, my implementation currently accepts
> any valid value. Thus, '3', '"hello"', 'true', 'false', and 'null'
> are all accepted by my implementation, but are not strictly JSON text.
> The question is: should the JSON datatype accept atomic values (those
> that aren't arrays or objects) as valid JSON?
>
Not really sure about this myself, but keep in mind that NULL has
special meaning in SQL.
> Also, should we go even further and accept key:value pairs by themselves? :
>
> '"key":"value"'::JSON
>
>
No, especially considering that '{"key":"value"}' is a valid JSON value.
> I improved my JSON library. It now only accepts strict, UTF-8 encoded
> JSON values (that is, objects, arrays, strings, numbers, true, false,
> and null).
>
Just a note, but PostgreSQL has some UTF-8 validation code, you might
want to look at it maybe, at least once you start the actual integration
into core, so that you are not reinventing too many wheels. I can see
how your own code is good thing for general library which this can (and
I am sure will be) used as, but for the datatype itself, it might be
better idea to use what's already there, unless it's somehow
incompatible of course.
--
Regards
Petr Jelinek (PJMODOS)
From | Date | Subject | |
---|---|---|---|
Next Message | Takahiro Itagaki | 2010-04-06 05:29:33 | Re: Compile fail, alpha5 & gcc 4.3.3 in elog.c |
Previous Message | Robert Haas | 2010-04-06 04:45:49 | Re: Proposal: Add JSON support |