json_agg doesn't generate the smallest json possible?

From: Glen Huang <heyhgl(at)gmail(dot)com>
To: "pgsql-general(at)postgresql(dot)org >> PG-General Mailing List" <pgsql-general(at)postgresql(dot)org>
Subject: json_agg doesn't generate the smallest json possible?
Date: 2017-04-28 04:24:01
Message-ID: C44CBDA8-EA02-4385-8EB2-12C00119579D@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi all,

I'm trying to use json_agg to generate some json array from the rows (which contain some json columns) I selected. But it seems the returned json contains some extraneous whitespace characters. Any efficient way I can get rid of them?

Also a quick question, if the final result is meant to be sent to a client, should I use json_agg or jsonb_agg?

Thanks.

Glen

Browse pgsql-general by date

  From Date Subject
Next Message Vik Fearing 2017-04-28 08:16:33 Re: LIMIT clause slowing down query in some cases, accelerating in others
Previous Message James Sewell 2017-04-28 00:45:13 Logical slot preservation after physical failover