Why won't my IoT Core rule to timestream parse the data in a usable way?

0

So, I have data coming into IoT Core that looks like this. { "clientID": "AWSPGFIFBI", "topic": "ie/d/j/simatic/v1/s7c1/dp/r/Test1200/default", "protocol": "mqtt", "payload": { "seq": 367645, "vals": [ { "dataType": "", "id": "101", "name": "", "qc": 3, "ts": "2023-06-20T16:02:27.4078740Z", "val": 54 } ] } }

How would I go about get the nested data in the array to show up in Timestream for example the "val" or "id"?

Thanks

posta un anno fa199 visualizzazioni
1 Risposta
0

You can use the nested object queries to get the values. https://docs.aws.amazon.com/iot/latest/developerguide/iot-sql-nested-queries.html

In your example , use the below messaging routing rule to get the value of "id" and "val".

SELECT get(payload.vals,0).val AS VAL FROM 'TestRule'

SELECT get(payload.vals,0).id AS ID FROM 'TestRule'

I used "TestRule" as source generating the data.

AWS
con risposta un anno fa

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande