Обсуждение: Array_to_json remove brackets

Поиск
Список
Период
Сортировка

Array_to_json remove brackets

От
Leonardo M. Ramé
Дата:
Hi, is there a way to get an array converted to json without brackets?.

I'm getting, for example [{"field": "value"}, {"field": "value"}] and I
want to get this: {"field": "value"}, {"field": "value"}.

Regards,

--
Leonardo M. Ramé
http://leonardorame.blogspot.com


Re: Array_to_json remove brackets

От
Merlin Moncure
Дата:
On Fri, Nov 13, 2015 at 7:20 AM, Leonardo M. Ramé <l.rame@griensu.com> wrote:
> Hi, is there a way to get an array converted to json without brackets?.
>
> I'm getting, for example [{"field": "value"}, {"field": "value"}] and I want
> to get this: {"field": "value"}, {"field": "value"}.

please supply an example.  Also,
{"field": "value"}, {"field": "value"}

is not valid json, so, basically, no.  But you could textually remove
them I guess but I'm thinking more context is needed to give a better
answer.

merlin


Re: Array_to_json remove brackets

От
Leonardo M. Ramé
Дата:
El 13/11/15 a las 10:49, Merlin Moncure escribió:
> On Fri, Nov 13, 2015 at 7:20 AM, Leonardo M. Ramé <l.rame@griensu.com> wrote:
>> Hi, is there a way to get an array converted to json without brackets?.
>>
>> I'm getting, for example [{"field": "value"}, {"field": "value"}] and I want
>> to get this: {"field": "value"}, {"field": "value"}.
>
> please supply an example.  Also,
> {"field": "value"}, {"field": "value"}
>
> is not valid json, so, basically, no.  But you could textually remove
> them I guess but I'm thinking more context is needed to give a better
> answer.
>
> merlin
>
>

Thanks, I fixed this with a simple trim command:

select trim('[abcd]', '[]');