tonyliang_id 2016-07-04 16:05 采纳率: 54.8%
浏览 8326
已采纳

如何在JS 中获取 JSON 对象中某个域的值

问题:如何在JS中获取"内省与专注"对应的score值?
基本情况:
1)JSON 格式化链接
2)JSON 内容

 {"data":[{"id":{"domain":"内省与专注","userName":"guest"},"score":35},{"id":{"domain":"创造力向度指标","userName":"guest"},"score":34},{"id":{"domain":"学校满意度","userName":"guest"},"score":33},{"id":{"domain":"学校激活度","userName":"guest"},"score":35},{"id":{"domain":"学生综合自评分","userName":"guest"},"score":34},{"id":{"domain":"应用向度指标","userName":"guest"},"score":37},{"id":{"domain":"数理逻辑思维","userName":"guest"},"score":37},{"id":{"domain":"沟通与交往","userName":"guest"},"score":34},{"id":{"domain":"理解与表达","userName":"guest"},"score":37},{"id":{"domain":"空间与建构","userName":"guest"},"score":31},{"id":{"domain":"综合动觉协调","userName":"guest"},"score":34},{"id":{"domain":"综合音乐素养","userName":"guest"},"score":33},{"id":{"domain":"观察与实践","userName":"guest"},"score":39},{"id":{"domain":"认知向度指标","userName":"guest"},"score":37},{"id":{"domain":"评价向度指标","userName":"guest"},"score":31}],"success":"true"}
  • 写回答

3条回答 默认 最新

  • tonyliang_id 2016-07-05 13:56
    关注
     {"data":[{"domain":"沟通与交往","score":39,"userName":"guest"},{"domain":"观察与实践","score":38,"userName":"guest"},{"domain":"综合音乐素养","score":37,"userName":"guest"},{"domain":"综合动觉协调","score":37,"userName":"guest"},{"domain":"内省与专注","score":35,"userName":"guest"},{"domain":"数理逻辑思维","score":34,"userName":"guest"},{"domain":"空间与建构","score":32,"userName":"guest"},{"domain":"理解与表达","score":32,"userName":"guest"}],"success":"true"}
    
         var obj;
        var url = "talent/summaryBar";
        var params = {
                username:"guest",
            };  
    
        $.ajax({ 
            type : "get", 
            url : url, 
            data : params, 
            async : false, 
            success : function(data){
                    obj = data;
                    /* var str = JSON.stringify( data );
                    alert(str);*/
                    alert(data.data[0].domain); 
                } 
            });
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 PointNet++的onnx模型只能使用一次
  • ¥20 西南科技大学数字信号处理
  • ¥15 有两个非常“自以为是”烦人的问题急期待大家解决!
  • ¥30 STM32 INMP441无法读取数据
  • ¥15 R语言绘制密度图,一个密度曲线内fill不同颜色如何实现
  • ¥100 求汇川机器人IRCB300控制器和示教器同版本升级固件文件升级包
  • ¥15 用visualstudio2022创建vue项目后无法启动
  • ¥15 x趋于0时tanx-sinx极限可以拆开算吗
  • ¥500 把面具戴到人脸上,请大家贡献智慧,别用大模型回答,大模型的答案没啥用
  • ¥15 任意一个散点图自己下载其js脚本文件并做成独立的案例页面,不要作在线的,要离线状态。