Re: JSON manipulation functions

Поиск
Список
Период
Сортировка
От Mike Rylander
Тема Re: JSON manipulation functions
Дата
Msg-id AANLkTikdYc_L1QhFh33JTsNqjAtNnsPBUY0pdRjK2JaG@mail.gmail.com
обсуждение исходный текст
Ответ на Re: JSON manipulation functions  (Robert Haas <robertmhaas@gmail.com>)
Список pgsql-hackers
On Fri, May 14, 2010 at 1:15 PM, Robert Haas <robertmhaas@gmail.com> wrote:
> On Thu, May 13, 2010 at 9:47 PM, Joseph Adams
> <joeyadams3.14159@gmail.com> wrote:

[snip]

>> == array/object conversion ==
>>
>> The json_object function converts a tuple to a JSON object.  If there
>> are duplicate column names, there will be duplicate keys in the
>> resulting JSON object.
>>
>> json_object([content [AS name] [, ...]]) returns json
>
> Seems good.
>
>> Likewise, the json_array function converts a tuple to a JSON array.
>> Column names are ignored.
>>
>> json_array([content [AS name] [, ...]]) returns json
>
> I think this is pointless and should be omitted.
>

(I'm going to avoid the use of the term "object" here to reduce confusion.)

I disagree with the assertion that it's pointless, and I have a
specific use-case in mind for this function.  I have a system that
uses JSON arrays on the wire to encapsulate data, and both ends
understand the positional semantics of the elements.  Using JSON
arrays instead of JSON objects reduces the transfer size by 40-80%,
depending on how "full" the rows (or class instances) are and the data
types of the elements, simply by removing the redundant object keys.
This function would be extremely useful to me when creating or
persisting raw class instances of these sorts.

--
Mike Rylander| VP, Research and Design| Equinox Software, Inc. / The Evergreen Experts| phone:  1-877-OPEN-ILS
(673-6457)|email:  miker@esilibrary.com| web:  http://www.esilibrary.com 


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

Предыдущее
От: "Marc G. Fournier"
Дата:
Сообщение: Re: List traffic
Следующее
От: Robert Haas
Дата:
Сообщение: recovery consistent != hot standby