On Tue, Oct 20, 2015 at 4:04 AM, Andreas Kretschmer <akretschmer@xxxxxxxxxxxxx> wrote:
If you are returning JSON, so is JSON the best choice.
The JSONB type represented as text (i.e., when you query it) is valid JSON. The same with JSON data type. The DB server renders the data as text when it sends it to you.
The choice should be made based on what you plant to do with the data in the database and if the properties of JSON are needed vs. the properties of JSONB (specifically duplicate key names and ordering of keys) or if it is not manipulated in the DB ever, then plain text is reasonable too.