小编Vin*_*ram的帖子

使用特殊字符\"在Javascript中提取JSON值

我如何从下面的 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});

javascript json node.js jsonparser

1
推荐指数
1
解决办法
52
查看次数

标签 统计

javascript ×1

json ×1

jsonparser ×1

node.js ×1