agora inbox for pgsql-sql@postgresql.org
help / color / mirror / Atom feedFrom: Andreas Joseph Krogh <andreas@visena.com>
To: pgsql-sql@postgresql.org
Subject: Re: generating json without nulls
Date: Thu, 7 May 2015 17:16:19 +0200 (CEST)
Message-ID: <VisenaEmail.70.7125f92dc9db25c2.14d2ef26624@tc7-visena> (raw)
In-Reply-To: <554B44EA.4070803@gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-sql>
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: <VisenaEmail.70.7125f92dc9db25c2.14d2ef26624@tc7-visena>
Permalink: ../VisenaEmail.70.7125f92dc9db25c2.14d2ef26624@tc7-visena/
Also on: postgresql.org/message-id/VisenaEmail.70.7125f92dc9db25c2.14d2ef26624@tc7-visena
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: andreas@visena.com
Subject: Re: generating json without nulls
In-Reply-To: <VisenaEmail.70.7125f92dc9db25c2.14d2ef26624@tc7-visena>
* 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