由于对服务的POST调用,我有一个字典输出
var request = require('request');
var options = {
url: 'http://localhost:5000/parse?q=hello&model=MY_NLU_MODEL_PATH'
};
function callback(error, response, body) {
if (!error && response.statusCode == 200) {
console.log(body);
}
}
request(options, callback);
输出为
{
"intent": {
"name": "greet",
"confidence": 1.0
},
"entities": [],
"text": "hello",
"project": "default",
"model": "fallback"
}
我要提取intent.name
项。我该怎么办?
我调查了this thread中的讨论,但无法提取这些项目。有什么建议吗?