简体   繁体   中英

Adaptive Card Templating JSON Key with Space

I'm having trouble using an API response for data in regards to Adaptive Card templating because some of the keys have spaces. Here's an example:

Data

{
  "General": {
    "Computer Name": "Computer-Name",
    "IP Address": "x.x.x.x",
    "Description": "person@example.com",
    "Icon": 2,
  },
  "Operating System": {
    "Name": "Computer-Name",
    "Version": "Microsoft Windows 11 Pro - 21H2/22000",
    "Architecture": "64-bit"
  },
  "BIOS": {
    "Vendor": "Microsoft Corporation",
    "Version": "9.106.140"
  },
  "Motherboard": {
    "Vendor": "Microsoft Corporation",
    "Name": "Surface Laptop 3",
    "CPU": "Intel(R) Core(TM) i5-1035G7 CPU @ 1.20GHz",
    "GPU1": "Intel(R) Iris(R) Plus Graphics"
  },
  "Memory": {
    "BANK 0": {
      "Capacity/Speed": "4096 Mb, 4267 Mhz",
      "Part Number": "Samsung, K4U6E3S4AA-MGCL     "
    },
    "BANK 2": {
      "Capacity/Speed": "4096 Mb, 4267 Mhz",
      "Part Number": "Samsung, K4U6E3S4AA-MGCL     "
    }
  },
  "Storage": {
    "KBG40ZNS256G TOSHIBA MEMORY": {
      "Capacity": "244191Mb"
    }
  }
}

How would I access, for example the Computer Name field under General in an adaptive card template? I've tried ${General."Computer Name"} both with single and double quotes, and also with and without brackets. I've been beating my head against the wall on this for a while so anyhelp would be appreciated!

Have you tried backticks ?

如何处理带有空格的 JSON 属性

Reference

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM