小编e79*_*ene的帖子

Postgres:如何将json字符串转换为文本?

Json值可以包含字符串值.例如.:

postgres=# SELECT to_json('Some "text"'::TEXT);
     to_json
-----------------
 "Some \"text\""
Run Code Online (Sandbox Code Playgroud)

如何将该字符串提取为postgres文本值?

::TEXT不起作用.它返回引用的json,而不是原始字符串:

postgres=# SELECT to_json('Some "text"'::TEXT)::TEXT;
     to_json
-----------------
 "Some \"text\""
Run Code Online (Sandbox Code Playgroud)

谢谢.

PS我正在使用PostgreSQL 9.3

postgresql json

76
推荐指数
4
解决办法
7万
查看次数

标签 统计

json ×1

postgresql ×1