【问题标题】:Actions on Google ReportState Json for C# .netcore 3.1针对 C# .net core 3.1 的 Google ReportState Json 的操作
【发布时间】:2021-06-20 21:36:34
【问题描述】:

我们对回复 Google HomeGraph 有以下 json 要求。

{
  "requestId": "123ABC",
  "agentUserId": "user-123",
  "payload": {
    "devices": {
      "states": {
        "light-123": {
          "on": true
        }
      }
    }
  }
}

我可以用 .netcore 2.1 和 NewtonSoft 伪造这个。您如何将其表示为 .netcore 3.1 和 system.text.json 的对象?特别是表示“light-123”的变量字符串。从我正在使用的控制器:

return new JsonResult(jsonObject)

【问题讨论】:

    标签: c# actions-on-google asp.net-core-3.1


    【解决方案1】:

    一种方法是使用自定义 JSON 属性命名策略。有点丑。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-03-25
      • 2022-07-06
      • 2020-06-19
      • 1970-01-01
      • 2021-01-24
      相关资源
      最近更新 更多