我如何从下面的 json 中提取文本,因为它包含 \" 它给了我一个未定义的
{
"answers":[
{
"questions":[ ],
"answer":"{\"text\":\"I am Ellina. I can't believe you forgot my name\",\"speech\":\"I am Ellina. I can't believe you forgot my name\"}",
"score":100,
"id":106,
"source":"Editorial",
"metadata":[
],
"context":{
"isContextOnly":false,
"prompts":[
]
}
}
],
"debugInfo":null,
"activeLearningEnabled":false
}
Run Code Online (Sandbox Code Playgroud)
我尝试使用 console.log(
Answer: ${JSON.stringify(res.data.answers[0].answer.text)}); 还有console.log(Answer: ${res.data.answers[0].answer.text});