【发布时间】:2021-04-26 15:17:24
【问题描述】:
我有一个复杂的数组,在表格列中如下所示:
{
"sometag": {},
"where": [
{
"id": "Krishna",
"nick": "KK",
"values": [
"0"
],
"function": "ADD",
"numValue": [
"0"
]
},
{
"id": "Krishna1",
"nick": "KK1",
"values": [
"0"
],
"function": "SUB",
"numValue": [
"0"
]
}
],
"anotherTag": [],
"TagTag": {
"tt": "tttttt",
"tt1": "tttttt"
}
在这个数组中,我想更新 id: "Krishna" 的函数和 numValue。
请帮忙。
【问题讨论】:
-
到目前为止你尝试过什么?你的预期输出是什么?为什么 numValue 是一个数组?
-
numValue 可以有多个值。期望输出:{“sometag”:{},“where”:[{“id”:“Krishna”,“nick”:“KK”,“values”:[“0”],“function”:“ADDITION” , "numValue": [ "0","1" ] }, { "id": "Krishna1", "nick": "KK1", "values": [ "0" ], "function": "SUB" , "numValue": [ "0" ] } ], "anotherTag": [], "TagTag": { "tt": "tttttt", "tt1": "tttttt" } }
-
使用正确规范化的数据模型会容易得多
标签: json postgresql jsonb