Sample Header Ad - 728x90

How to turn JSON array into Postgres array?

146 votes
8 answers
475618 views
I have a column data of type json that holds JSON documents like this: { "name": "foo", "tags": ["foo", "bar"] } I would like to turn the nested tags array into a concatenated string ('foo, bar'). That would be easily possible with the array_to_string() function in theory. However, this function does not accept json input. So I wonder how to turn this JSON array into a Postgres array (type text[])?
Asked by Christoph (1653 rep)
Dec 2, 2013, 08:48 PM
Last activity: Dec 16, 2024, 08:18 AM