Re: generating json without nulls

From: Tim Dudgeon <tdudgeon(dot)ml(at)gmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: generating json without nulls
Date: 2015-05-07 15:29:04
Message-ID: 554B84C0.1070007@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

That's not going to work. I want the row, I just don't want the values
that are null.

Tim

On 07/05/2015 16:16, Andreas Joseph Krogh wrote:
> På torsdag 07. mai 2015 kl. 12:56:42, skrev Tim Dudgeon
> <tdudgeon(dot)ml(at)gmail(dot)com <mailto:tdudgeon(dot)ml(at)gmail(dot)com>>:
>
> Hi All!
> I'm using the postgres json functions to generate json for values in a
> table.
> Something like this:
>
> SELECT row_to_json(a_table) FROM a_table
>
> But my data has lots of null values and that results in json
> attributes
> like this:
>
> "colname":null
>
> I want to exclude those values from the json and only include non-null
> values.
> Any idea how to best go about this?
>
> Tim
>
> WHERE colname IS NOT NULL ?
> --
> *Andreas Joseph Krogh*
> CTO / Partner - Visena AS
> Mobile: +47 909 56 963
> andreas(at)visena(dot)com <mailto:andreas(at)visena(dot)com>
> www.visena.com <https://www.visena.com>
> <https://www.visena.com>

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message David G. Johnston 2015-05-07 16:27:00 Re: generating json without nulls
Previous Message Andreas Joseph Krogh 2015-05-07 15:16:19 Re: generating json without nulls