调用具有非字母字符的 JSON 键

Calling a JSON key that has a non-letter character

我正在尝试从下面的 json 对象中 return @microsoft.graph.downloadUrl 的值:

[
  {
    '@microsoft.graph.downloadUrl': 'https://public.bl.files.1drv.com/XXXX',
    createdDateTime: '2021-07-10T06:14:31.03Z',
    cTag: 'QQQQ',
    eTag: 'SSSS',
    id: 'FFFF',
    lastModifiedDateTime: '2021-07-12T09:27:21.69Z',
    name: 'FILE_NAME',
    size: 98580,
    webUrl: 'https://1drv.ms/b/SSSS',
    reactions: { commentCount: 0 },
    createdBy: { application: [Object], user: [Object] },
    lastModifiedBy: { user: [Object] },
    parentReference: {
      driveId: 'XXX',
      driveType: 'personal',
      id: 'YYYY!YYY',
      name: 'Documents',
      path: '/drive/root:/Documents'
    },
    file: { mimeType: 'application/pdf', hashes: [Object] },
    fileSystemInfo: {
      createdDateTime: '2021-07-10T06:14:31.03Z',
      lastModifiedDateTime: '2021-07-12T09:27:21.69Z'
    }
  }
]

我希望使用类似的方法来提取名称,因为我需要能够从 json 中的每个 json 对象(下面称为 f)中获取 @microsoft.graph.downloadUrl =24=].

var fileName = (JSON.stringify(files[f].name));

我都试过了:

var fileURL = (JSON.stringify(files[f]."@microsoft.graph.downloadUrl"));
var fileURL = (JSON.stringify(files[f].@microsoft.graph.downloadUrl));

但都不起作用 - 任何帮助将不胜感激!

你应该只使用 files[f]["@microsoft.graph.downloadUrl"].