History of 2020-12-21 Pretty printing json and jsonb columns in PostgreSQL

2020-12-21
19:12 UTC Revision 1 . . . . mborkAnd for today I have yet another short PostgreSQL tip. I use a database which has quite a few tables with jsonb – and also json – type fields. (I know, I know. No new json columns, but legacy etc.) Since they often contain quite a few things, pretty printing them is something I tend to do fairly often. Happily, PostgreSQL has a function to do that. Less happily, it only works with jsonb columns, and has a long, awkward name: jsonb_pretty. But it’s no longer a problem for me, since it is easy to create a shorthand.