如何从 IoT 中心获取原始 JSON?

How to get the raw JSON coming from an IoT Hub?

我正在使用流分析来检索放置在 IoTHub 上的 JSON 消息。我需要能够在 SQL 服务器 table 中检索并存储原始 JSON 字符串。我似乎找不到办法做到这一点。可能吗?

否,除非您将 json 作为字符串包装在另一个发送到 IoT 中心的 json 对象中。

否则解决方案是尝试是否可以使用 Javascript function 对 json 对象进行字符串化/构造,然后将其存储在数据库中。

  • 检索

流式分析作业 支持从 IoT 中心检索 JSON 消息。你可以在添加流输入时将事件序列化格式设置为JSON类型:

  • 商店

流式分析作业支持写入 SQL 数据库。

但是注意:

Currently the Azure SQL Database offering is supported for a job output in Stream Analytics. However, an Azure Virtual Machine running SQL Server with a database attached is not supported. This is subject to change in future releases.

因此,如果您的意思是 "SQL Server table" 作为 Azure 虚拟机 运行 SQL 带有数据库的服务器,目前答案是 "NO"。