小编TSK*_*TSK的帖子

如何从json数组中删除对象?

我的表:

CREATE TABLE items (
    id BIGINT PRIMARY KEY NOT NULL,
    name VARCHAR,
    images json
);
Run Code Online (Sandbox Code Playgroud)

图片格式:

[
  {
    "id": "owner",
    "full": "<url>",
    "thumb": "<url>"
  },
  {
    "id": "note_0",
    "full": "<url>",
    "thumb": "<url>"
  },
  {
    "id": "note_1",
    "full": "<url>",
    "thumb": "<url>"
  },
  {
    "id": "note_2",
    "full": "<url>",
    "thumb": "<url>"
  }
]
Run Code Online (Sandbox Code Playgroud)

我需要这样的东西:

UPDATE items SET images = delete(images, 'note_1');
Run Code Online (Sandbox Code Playgroud)

postgresql postgresql-9.3 json

5
推荐指数
1
解决办法
1万
查看次数

标签 统计

json ×1

postgresql ×1

postgresql-9.3 ×1