agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
From: Tim Dudgeon <tdudgeon.ml@gmail.com>
To: pgsql-sql@postgresql.org
Subject: Re: generating json without nulls
Date: Thu, 07 May 2015 16:29:04 +0100
Message-ID: <554B84C0.1070007@gmail.com> (raw)
In-Reply-To: <VisenaEmail.70.7125f92dc9db25c2.14d2ef26624@tc7-visena>
References: <VisenaEmail.70.7125f92dc9db25c2.14d2ef26624@tc7-visena>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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.ml@gmail.com <mailto:tdudgeon.ml@gmail.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@visena.com <mailto:andreas@visena.com>
> www.visena.com <https://www.visena.com;
> <https://www.visena.com;

view thread (6+ messages)  latest in thread

Message-ID: <554B84C0.1070007@gmail.com>
Permalink:  ../554B84C0.1070007@gmail.com/
Also on:    postgresql.org/message-id/554B84C0.1070007@gmail.com

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tdudgeon.ml@gmail.com
  Subject: Re: generating json without nulls
  In-Reply-To: <554B84C0.1070007@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox