Re: JSON row_to_json_array

Поиск
Список
Период
Сортировка
От Tjibbe R
Тема Re: JSON row_to_json_array
Дата
Msg-id BLU0-SMTP88643100CD56672B3F447DD2D0@phx.gbl
обсуждение исходный текст
Ответ на Re: JSON row_to_json_array  (Luca Ferrari <fluca1978@infinito.it>)
Ответы Re: JSON row_to_json_array  (Luca Ferrari <fluca1978@infinito.it>)
Re: JSON row_to_json_array  (Merlin Moncure <mmoncure@gmail.com>)
Список pgsql-novice
Yes it would be a simple array, but it costs a lot of coding. Because every item in the array need to be inserted in the function to_json().

Example:

DECLARE
_arr json[];
FOR row in SELECT * FROM persons LOOP
   _arr := array_append (_arr, ARRAY(to_json(row.id), to_json(row.birthdate), to_json (row.active_bool),to_json(row.level)); 
END LOOP;
RETURN to_json(_arr);


On 23 September 2013 08:42, Luca Ferrari <fluca1978@infinito.it> wrote:
On Sat, Sep 21, 2013 at 10:26 PM, Tjibbe R <tjibbe@rijpma.org> wrote:
> Hello,
>
> Why isn't there a row_to_json_array(record) funtion?
>

I'm not a json expert, but it could be the output would not be a json
structure (after all, it would be a simple array)?

Luca

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

Предыдущее
От: Luca Ferrari
Дата:
Сообщение: Re: JSON row_to_json_array
Следующее
От: Luca Ferrari
Дата:
Сообщение: Re: JSON row_to_json_array