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
gefragt vor 10 Monaten266 Aufrufe
1 Antwort
1
Akzeptierte Antwort

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
EXPERTE
Greg_B
beantwortet vor 10 Monaten

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen