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

gefragt vor einem Jahr199 Aufrufe
1 Antwort
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
beantwortet vor einem Jahr

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