0

我有一个保存 JSON 字符串的列,我想摆脱那个 JSON 对象的“zipcode”。如何使用 MySQL 函数实现这一点?

{name:"Alex", "address": [
 {"type": "primary", "street": "bakers street", "zipcode": 90001},
 {"type": "secondary", "street": "honor street", "zipcode": 90002}
]
}

我试过这个 select JSON_REMOVE(JSON_EXTRACT(JSON_EXTRACT(@payload_json,'$. address'), '$[0]'),'$. zipcode') ,但结果像

     {"type": "primary", "street": "bakers street",},
     {"type": "secondary", "street": "honor street", "zipcode": 90002}
    ]
    }``` 

> Is there a way I could do it all at once?
4

0 回答 0