AWS IoT SQL: What happens if I SELECT a JSON payload key that doesn't exist?

0

Hi,

Let's assume I have the following AWS IoT SQL statement:

SELECT device, room, value FROM 'topic/subtopic'

and this runs over the following incoming payload:

{
"device": "sensor1",
"value": 34
}

Will the resulting output from this SQL statement be:

{
"device": "sensor1",
"room": "",
"value": 34
}

or

{
"device": "sensor1",
"room": "null",
"value": 34
}

or:

{
"device": "sensor1",
"value": 34
}

or something else entirely? Or would the rule raise a parsing error or the like?

cgddrd
已提问 10 个月前266 查看次数
1 回答
1
已接受的回答

Hi. It will be:

{
  "device": "sensor1",
  "value": 34
}

BTW, it's is quite easy to test things like this by creating a rule with a republish action, and then trying it out with the test client in the console.

profile pictureAWS
专家
Greg_B
已回答 10 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则