Re: Proposal: Add JSON support

Поиск
Список
Период
Сортировка
От Joseph Adams
Тема Re: Proposal: Add JSON support
Дата
Msg-id k2le7e5fefd1004030559h449d22f1wc7940673bd8e4a5c@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Proposal: Add JSON support  ("David E. Wheeler" <david@kineticode.com>)
Ответы Re: Proposal: Add JSON support
Список pgsql-hackers
I've been wondering whether the JSON datatype should be strict or conservative.

For one, there's strict JSON (following the exact specification).
Then there's more conservative JSON variants.  Some JSON parsers
support comments, some support invalid number formats (e.g. '3.' or
'+5'), etc..

The consensus seems to be that JSON content should be stored verbatim
(it should store the exact string the client sent to it), as is done
with XML.  However, this notion is somewhat incompatible with "Be
conservative in what you do; be liberal in what you accept from
others" because we can't accept loose JSON, then spit out conservative
JSON without messing with the content.

Here's my idea: the datatype should only allow strict JSON, but there
should be a function that accepts a liberal format, cleans it up to
make it strict JSON, and converts it to JSON.  I think making strict
JSON the default makes the most sense because:* Inputs to the database will most likely be coming from programs, not
humans.*Output is expected to be valid JSON and work anywhere JSON should work.* Strict JSON is what more people would
expect,I'd think.
 


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

Предыдущее
От: Simon Riggs
Дата:
Сообщение: Re: message clarifications
Следующее
От: Markus Wanner
Дата:
Сообщение: Re: [RFC] nodeToString format and exporting the SQL parser