I want to remove the 'field1' object pair from the JSON in postgres

Here is what I have tried so far,

  • updatedJson -> 0 ->> 'values' - '"field1"'
  • i tried using the #- Delete the field or element with specified path (for JSON arrays, negative integers count from the end)

Both steps didn't help me. I am new to Postgres. Is there any way like getting the path and deleting it. I am using jsonb. PostgreSQL version: 9.6. Kindly help


i tried using the #-

What specifically did you try?

Using #- works for me, specifically updatedJson #- '{0,values,0}'

| improve this answer | |
  • i dont know the index. how to calculate the index of the particular field. it may in any position @jjanes, – Kalaiarasan Manimaran Jan 24 at 8:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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