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
asked 9 months ago235 views
1 Answer
1
Accepted Answer

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
EXPERT
Greg_B
answered 9 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions