1

I have data structure like:

  • id bigint
  • articles jsonb

Example:

id: 1,
articles: {
  "1": {
    "title": "foo"
  },
  "2": {
    "title": "bar"
  }
}

I want to change field name of title (for example articleTitle). Is there any easy way to do that ?

Edit: I can do that with string replace, but can I do that operating on jsonb? Like using jsonb_set() ?

UPDATE person 
SET articles = replace(articles::TEXT,'"title":','"articleTitle":')::jsonb
bmit
  • 61
  • 7

0 Answers0