PostgreSQL 9.5: SELECT JSON Formatted data using jsonb_pretty()

Recently, PostgreSQL introduced JSON data type which is very powerful to manipulate JSON formatted data.

I have published a couple of articles on JSON Data Type.
You can start from here.

PostgreSQL 9.4: The JSON data type is Awesome (Part 1/3)

Recently, I have received a couple of comments on my FB page related use of PostgreSQL JSONB.

A JSONB data type does not preserve any white spaces. Whatever format we have specified, It removes and store without white spaces.

PostgreSQL 9.5 introduced jsonb_pretty() to get JSON formatted data.
When we are troubleshooting JSON related data at that time we require to get JSON in readable format.

Below is a small demonstration of jsonb_pretty():

Create table with sample JSON data:

Using jsonb_pretty format function:


Please share your ideas and opinions about this topic with me, your contribution will add true value to this topic.
If anyone has doubts on this topic then please do let me know by leaving comments or send me an email.

If you like this post, then please share it with others.
Please follow, I will share my experience towards the success of Database Research and Development Activity.

I put up a post every day, please keep reading and learning.
Discover Yourself, Happy Blogging !
Anvesh M. Patel.

More from