[–] jackhalford 4y ago ↗ I was looking for a way to pretty print json in postgres today, the simplest I came up with is a 'json_mode.sql' script: \t on \pset pager always \pset format unaligned \setenv PAGER 'jq .' then all selects of a json column are readable. [–] ttfkam 4y ago ↗ Why not:jsonb_pretty(jsonb) → textorjsonb_to_record(jsonb) → record jsonb_to_recordset(jsonb) → setof recordhttps://www.postgresql.org/docs/current/functions-json.html [–] jackhalford 4y ago ↗ I came across this while googling but it seems the jsonb_pretty function isn't available in my postgres
[–] ttfkam 4y ago ↗ Why not:jsonb_pretty(jsonb) → textorjsonb_to_record(jsonb) → record jsonb_to_recordset(jsonb) → setof recordhttps://www.postgresql.org/docs/current/functions-json.html [–] jackhalford 4y ago ↗ I came across this while googling but it seems the jsonb_pretty function isn't available in my postgres
[–] jackhalford 4y ago ↗ I came across this while googling but it seems the jsonb_pretty function isn't available in my postgres
5 comments
[ 0.24 ms ] story [ 29.5 ms ] threadjsonb_pretty(jsonb) → text
or
jsonb_to_record(jsonb) → record jsonb_to_recordset(jsonb) → setof record
https://www.postgresql.org/docs/current/functions-json.html