Crank-7 2022-01-05 10:31 采纳率: 100%
浏览 48
已结题

多层json文件 怎么读取里面其中的值

问题遇到的现象和发生背景
"nodeName": "u_ok_001",
"sementicItem": {
  "sementicItemId": "31",
  "value": "Ok(yes)"
},
"tableRuleData": [
  {
    "example": {
      "ruleId": "373",
      "phraseItems": [
        {
          "phraseItemId": "333",
          "indexValue": "1",
          "phraseItemIndexId": "1017",
          "maxDistance": "",
          "matchedWords": [{
            "matchedWordId": "940",
            "value": "好"
          }],
          "excludeWords": [
            {
              "excludeWordId": "93",
              "value": "人工",
              "rightMaxDistance": "",
              "leftMaxDistance": "5"
            }
          ]
        },
        {
          "phraseItemId": "340",
          "indexValue": "8",
          "phraseItemIndexId": "1018",
          "maxDistance": "2",
          "matchedWords": [{
            "matchedWordId": "973",
            "value": "还行"
          }],
          "excludeWords": [
            {
              "excludeWordId": "94",
              "value": "人工",
              "rightMaxDistance": "8",
              "leftMaxDistance": ""
            }
          ]
        }
      ]
    },
    "standardWord": {}
  }
],
"tablePhrase": [
  {
    "phraseItem": {
      "id": "333",
      "indexValue": "1",
      "slot": ""
    },
    "matchedWords": [
      {
        "matchedWordId": "940",
        "value": "好",
        "maxPosIndex": 2,
        "maxSpeechLength": null,
        "autoUnexpectedWord": true,
        "weight": null,
        "unexpectedWords": []
      },
      {
        "matchWordId": "941",
        "value": "蛮好",
        "maxPosIndex": 0,
        "maxSpeechLength": 2,
        "autoUnexpectedWord": true,
        "weight": null,
        "unexpectedWords": []
      },
      {
        "matchWordId": "942",
        "value": "可以",
        "maxPosIndex": 3,
        "maxSpeechLength": 8,
        "autoUnexpectedWord": true,
        "weight": null,
        "unexpectedWords": []
      },
      {
        "matchWordId": "943",
        "value": "o_k",
        "maxPosIndex": 1,
        "maxSpeechLength": 3,
        "autoUnexpectedWord": true,
        "weight": null,
        "unexpectedWords": []
      },
      {
        "matchWordId": "944",
        "value": "行",
        "maxPosIndex": 0,
        "maxSpeechLength": 2,
        "autoUnexpectedWord": true,
        "weight": null,
        "unexpectedWords": []
      },
      {
        "matchWordId": "945",
        "value": "中",
        "maxPosIndex": 0,
        "maxSpeechLength": 1,
        "autoUnexpectedWord": true,
        "weight": null,
        "unexpectedWords": []
      },
      {
        "matchWordId": "946",
        "value": "是",
        "maxPosIndex": 2,
        "maxSpeechLength": 2,
        "autoUnexpectedWord": true,
        "weight": null,
        "unexpectedWords": [
          {
            "unexpectedWordId": "173",
            "value": "是因为"
          },
          {
            "unexpectedWordId": "174",
            "value": "这个是"
          },
          {
            "unexpectedWordId": "175",
            "value": "这是"
          },
          {
            "unexpectedWordId": "176",
            "value": "是不是"
          },
          {
            "unexpectedWordId": "177",
            "value": "你们是"
          },
          {
            "unexpectedWordId": "178",
            "value": "你是"
          },
          {
            "unexpectedWordId": "179",
            "value": "是他"
          },
          {
            "unexpectedWordId": "180",
            "value": "是十"
          },
          {
            "unexpectedWordId": "181",
            "value": "是三"
          },
          {
            "unexpectedWordId": "182",
            "value": "给我是"
          }


        ]
      },
      {
        "matchWordId": "947",
        "value": "对",
        "maxPosIndex": 0,
        "maxSpeechLength": 2,
        "autoUnexpectedWord": true,
        "weight": null,
        "unexpectedWords": []
      },
      {
        "matchWordId": "948",
        "value": "嗯",
        "maxPosIndex": 2,
        "maxSpeechLength": 4,
        "autoUnexpectedWord": true,
        "weight": null,
        "unexpectedWords": []
      }
    ]
  }
]
问题相关代码,请勿粘贴截图

前端页面如何怎么读取json文件下任意值 一层一层读的方法是什么

运行结果及报错内容
我的解答思路和尝试过的方法
我想要达到的结果
  • 写回答

4条回答 默认 最新

  • CSDN专家-黄老师 2022-01-05 10:56
    关注

    json只能通过一层一层地读取

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

问题事件

  • 系统已结题 1月15日
  • 已采纳回答 1月7日
  • 修改了问题 1月5日
  • 创建了问题 1月5日

悬赏问题

  • ¥15 IAR程序莫名变量多重定义
  • ¥15 (标签-UDP|关键词-client)
  • ¥15 关于库卡officelite无法与虚拟机通讯的问题
  • ¥100 已有python代码,要求做成可执行程序,程序设计内容不多
  • ¥15 目标检测项目无法读取视频
  • ¥15 GEO datasets中基因芯片数据仅仅提供了normalized signal如何进行差异分析
  • ¥100 求采集电商背景音乐的方法
  • ¥15 数学建模竞赛求指导帮助
  • ¥15 STM32控制MAX7219问题求解答
  • ¥20 在本地部署CHATRWKV时遇到了AttributeError: 'str' object has no attribute 'requires_grad'