我有以下对象数据:
var response = {
"response": {
"numFound": 7945,
"docs": [{
"description": "target",
"url": "target",
"id": "269653",
"score": 6.9186745
},
{
"description": "Target Kent",
"url": "Target_Kent",
"id": "37275",
"score": 4.3241715
}]
},
"highlighting": {
"269653": {
"description": ["<em>target</em>"]
},
"37275": {
"description": ["<em>Target</em> Kent"]
}
}
};
我可以使用response.response.docs[0].description
打印"target"
。但我不知道如何打印"<em>target</em>"
。谢谢。
答案 0 :(得分:1)
response.highlighting[269653].description[0]
答案 1 :(得分:0)
假设您需要保留对docs [0]或其他任何对象引用的引用:
response.highlighting[response.response.docs[0].id].description[0]