Re: Returning JSON or JSONB - Mailing list pgsql-general

From Vick Khera
Subject Re: Returning JSON or JSONB
Date
Msg-id CALd+dcdz+ycrXrAik0kn40BOCZ0RXNx68FmB807_Tg1L+Vct0g@mail.gmail.com
Whole thread Raw
In response to Re: Returning JSON or JSONB  (Andreas Kretschmer <akretschmer@spamfence.net>)
List pgsql-general

On Tue, Oct 20, 2015 at 4:04 AM, Andreas Kretschmer <akretschmer@spamfence.net> 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.

pgsql-general by date:

Previous
From: Vladimir Sitnikov
Date:
Subject: Configurable length of application_name and/or read access to custom gucs of another backend
Next
From: Dane Foster
Date:
Subject: Re: My first PL/pgSQL function