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

asked 10 months ago189 views
1 Answer
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
answered 10 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