如何获取包含“:”符号的属性json
除了“properties”块之外,其他都可以,下面的命令不起作用
'comMedecin': success.entry.properties.os:commentaireSecretaire ? success.entry.properties.os:commentaireSecretaire : '',
要使用这样命名的属性,您需要使用:
success.entry.properties['os:commentaireSecretaire']
简短工作示例:
const json = '{ "a:b:c": 5 }'; const obj = JSON.parse(json); // 5 console.log(obj['a:b:c']);