0

Table: api
column: id serial
Column : jdoc jsonb

id = 4, jdoc = [{"a": [2, 3, 4]}]  

How can I convert jsonb array to jsonb? In another word.
How can I get id = 4, jdoc = {"a": [2, 3, 4]}
Similar question: Converting jsonb to jsonb array in postgres

3
  • I don't quite uderstand your question. A jsonb array is a jsonb. Do you want to extract the first (maybe the only element in your case) element of the array? Commented Sep 28, 2021 at 10:01
  • I want to transform from [{"a": [2, 3, 4]}] to {"a": [2, 3, 4]} Commented Sep 28, 2021 at 10:16
  • 1
    select jdoc->0 from api Commented Sep 28, 2021 at 10:36

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.