文章详情页
mysql储存json错误
浏览:61日期:2022-06-11 16:51:10
问题描述
最近在使用mysql的json储存格式,出现了很蹊跷的问题。
INSERT INTO `json` (`notes`) VALUES (’[{'name':1}]’);我用上述语句插入json数组,navicat的显示是正常的当我用UPDATE json SET notes =json_array_append(notes, ’$’ , ’['sa']’ ) WHERE ID=6;添加新的json时候出现了转义符
请问这是出现了什么问题呢?
问题解答
回答1:json_array_append(notes, ’$’ , ’['sa']’ ) 改为json_array_append(notes, ’$’ , CAST(’['sa']’ AS JSON))
相关文章:
排行榜
