Re: Array_to_json remove brackets

From: Leonardo M(dot) Ramé <l(dot)rame(at)griensu(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Array_to_json remove brackets
Date: 2015-11-13 13:58:42
Message-ID: 5645EC92.1070801@griensu.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

El 13/11/15 a las 10:49, Merlin Moncure escribió:
> On Fri, Nov 13, 2015 at 7:20 AM, Leonardo M. Ramé <l(dot)rame(at)griensu(dot)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]', '[]');

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2015-11-13 14:05:00 Re:
Previous Message Doiron, Daniel 2015-11-13 13:51:01 Re: Does PostgreSQL ever create indexes on its own?