Re: Proposal: Add JSON support

Поиск
Список
Период
Сортировка
От Petr Jelinek
Тема Re: Proposal: Add JSON support
Дата
Msg-id 4BBAC00B.4000801@pjmodos.net
обсуждение исходный текст
Ответ на Re: Proposal: Add JSON support  (Joseph Adams <joeyadams3.14159@gmail.com>)
Список 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)



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: Proposal: Add JSON support
Следующее
От: Takahiro Itagaki
Дата:
Сообщение: Re: Compile fail, alpha5 & gcc 4.3.3 in elog.c