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
demandé il y a 10 mois266 vues
1 réponse
1
Réponse acceptée

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
répondu il y a 10 mois

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions