如何从json输出中检索值

问题描述 投票:-1回答:1

我想从console.log的共享输出下面检索成绩单值。但是只有那个具有另一个键的成绩单值是confidence

console.log的输出:

  Data: {
    "results": [
    {
    "keywords_result": {
    "blocked": [
    {
    "normalized_text": "blocked",
    "start_time": 1.1,
    "confidence": 0.64,
    "end_time": 1.68
    }
    ]
    },
    "alternatives": [
    {
    "confidence": 0.81,
    "transcript": "your Name is Charlie "
    },
    {
    "transcript": "your Name is Charlie and "
    },
    {
    "transcript": "your Name is Charlies "
    }
    ],
    "final": true
    }
    ],
    "result_index": 0
    }
    Close: 1000

预期输出:

your Name is Charlie

请注意,我希望值应该从console.log输出变为一个可以进一步使用的变量。]​​>

我需要从console.log(event)获得一些特定的输出,我如何仅从该console.log获得可用的置信度关键字的笔录输出。这是console.log(JSON.stringify(event)响应:...

javascript node.js ibm-cloud
1个回答
0
投票

您可以做这样的事情:


0
投票

请参考下面的代码。

© www.soinside.com 2019 - 2024. All rights reserved.