[英]How to parse json value of text column in postgres
I have a column of text type be contain json value. 我有一列文字类型包含json值。
{"summary":"this is a example","url":"stackoverflow.com"}
How can I extract ' url ' json field of column in postgres with query? 我怎样才能提取“URL” JSON列的领域与查询Postgres的?
I used of following query: 我使用以下查询:
SELECT jvalue->>'url' From table;
With my query, I get following error. 与我的查询,我得到以下错误。
SQL Error [42883]: ERROR: operator does not exist: text ->> unknown Hint: No operator matches the given name and argument type(s).
SQL错误[42883]:错误:运算符不存在:文本->>未知提示:没有运算符匹配给定的名称和参数类型。 You might need to add explicit type casts.
您可能需要添加显式类型转换。 org.postgresql.util.PSQLException: ERROR: operator does not exist: text ->> unknown Hint: No operator matches the given name and argument type(s).
org.postgresql.util.PSQLException:错误:不存在运算符:text->> unknown提示:没有运算符匹配给定的名称和参数类型。 You might need to add explicit type casts.
您可能需要添加显式类型转换。
您可以使用->
运算符:
SELECT '{"summary":"this is a example","url":"stackoverflow.com"}'::json->'url';
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.