全栈开发
数据库
【Q024】在 postgres 中,查询时如何对 jsonb 数据格式化

在 postgres 中,查询时如何对 jsonb 数据格式化

Issue 欢迎在 Gtihub Issue 中回答此问题: Issue 25 (opens in a new tab)

Author 回答者: shfshanyue (opens in a new tab)

使用 jsonb_pretty 函数,示例如下

> select jsonb_pretty('{"a": {"b": 4}}'::jsonb)
+----------------+
| jsonb_pretty   |
|----------------|
| {              |
|     "a": {     |
|         "b": 4 |
|     }          |
| }              |
+----------------+
SELECT 1
Time: 0.018s