workhard_man 2023-01-29 16:58 采纳率: 75%
浏览 25
已结题

mysql json嵌套数组如何提取其中的值

MySQL如何在json嵌套数组中提取值

{"$custom":{"sopCateId":21254045,"srType":300608401,"isCMS":true,"commonQueueId":999999},
"actionKeyMemo":[{"dataKey":"cateName","value":"入住/退房问题咨询 ","key":"会员问题"},{"dataKey":"bizId","value":"3165229512091656766","key":"订单编号"},{"dataKey":"contactName","value":"潘越海","key":"会员称呼"},{"dataKey":"ContactPhone","value":"17376048017","key":"联系方式"},{"dataKey":"WbbpHAarCM","value":"用户表示下单后 前台查询不到入住信息","key":"用户诉求"},{"dataKey":"preReply","value":"","key":"小二答复"},{"dataKey":"pfCanAutoFinish","value":"","key":"是否开启赔付托管"},{"dataKey":"pfAutoFinishStatus","value":"","key":"赔付托管结果"},{"dataKey":"Promise","value":"2023-01-25 17:44:44","key":"承诺回复时效"},{"dataKey":"DefaultRepl","value":"","key":"默认回复时效"}],"operatorNick":"淘枣科","acceptorNick":"潘潘318"}
该数组中,
如何将 {"dataKey":"Promise","value":"2023-01-25 17:44:44","key":"承诺回复时效"} 的时间数据"2023-01-25 17:44:44" 提取出来

  • 写回答

2条回答 默认 最新

  • 梦想橡皮擦 Python领域优质创作者 2023-01-29 17:15
    关注

    使用MySQL函数JSON_EXTRACT即可从嵌套的JSON数组中提取值。

    SELECT JSON_EXTRACT('{"$custom":{"sopCateId":21254045,"srType":300608401,"isCMS":true,"commonQueueId":999999},
    "actionKeyMemo":[{"dataKey":"cateName","value":"入住/退房问题咨询 ","key":"会员问题"},{"dataKey":"bizId","value":"3165229512091656766","key":"订单编号"},{"dataKey":"contactName","value":"潘越海","key":"会员称呼"},{"dataKey":"ContactPhone","value":"17376048017","key":"联系方式"},{"dataKey":"WbbpHAarCM","value":"用户表示下单后 前台查询不到入住信息","key":"用户诉求"},{"dataKey":"preReply","value":"","key":"小二答复"},{"dataKey":"pfCanAutoFinish","value":"","key":"是否开启赔付托管"},{"dataKey":"pfAutoFinishStatus","value":"","key":"赔付托管结果"},{"dataKey":"Promise","value":"2023-01-25 17:44:44","key":"承诺回复时效"},{"dataKey":"DefaultRepl","value":"","key":"默认回复时效"}],"operatorNick":"淘枣科","acceptorNick":"潘潘318"}',
    '$.actionKeyMemo[9].value') AS Promise_Time;
    
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

问题事件

  • 系统已结题 2月6日
  • 已采纳回答 1月29日
  • 修改了问题 1月29日
  • 创建了问题 1月29日

悬赏问题

  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化
  • ¥15 Mirare PLUS 进行密钥认证?(详解)
  • ¥15 物体双站RCS和其组成阵列后的双站RCS关系验证
  • ¥20 想用ollama做一个自己的AI数据库
  • ¥15 关于qualoth编辑及缝合服装领子的问题解决方案探寻
  • ¥15 请问怎么才能复现这样的图呀