【发布时间】:2017-05-25 17:12:38
【问题描述】:
我需要访问名称包含破折号的 JSON 数据,最好的解决方案是什么?删除破折号或只是处理 这是我从简单节点服务器接收的 JSON 数据。
[{
"id": "xxxxxxxxxxxxx",
"type": "container",
"path": "/",
"dctitle": "xxxx",
"dc-creator": "xxxx",
"dc-description": "xxxx.",
"dcrights": "xxxx",
"hero-region": {
"hero-headline": "xxxxxxxxxxxx",
"hero-headline-sub": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
}]
提前致谢!
【问题讨论】:
-
console.log(data[0]["hero-region"]["hero-headline"])