Join the Stack Overflow Community
Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up

I have a column of text type be contain json value.

{"summary":"this is a example","url":"stackoverflow.com"}

How can I extract 'url' json field of column in postgres with query?

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). 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). You might need to add explicit type casts.

share|improve this question
up vote 2 down vote accepted

You could use the -> operator:

SELECT '{"summary":"this is a example","url":"stackoverflow.com"}'::json->'url';
share|improve this answer
    
very thank you. – O.R Jul 30 '15 at 14:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.