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

已提问 1 年前199 查看次数
1 回答
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
已回答 1 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则