generating json without nulls - Mailing list pgsql-sql

From Tim Dudgeon
Subject generating json without nulls
Date
Msg-id 554B44EA.4070803@gmail.com
Whole thread Raw
Responses Re: generating json without nulls  (Andreas Joseph Krogh <andreas@visena.com>)
List pgsql-sql
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



pgsql-sql by date:

Previous
From: Steve Midgley
Date:
Subject: Re: [GENERAL] documenting tables version control
Next
From: Andreas Joseph Krogh
Date:
Subject: Re: generating json without nulls