IoT Events convert number to string for SNS custom payload

0

In IoT Events, I have setup an Event to send a message to SNS. I am attempting to use a custom payload where I can include the value in the message. The value outlined in red below is what I am trying to use and it is a Number. When I run the Analysis on my Event in the Detector GUI, it gives this warning: *Message: The payload expression "$input.CNC1Standard.vibration" isn't valid. Specify an expression that would evaluate to a string at runtime because the payload type is JSON format. *

I have looked through the documentation and cannot find the command or an example for how to convert a Number into a String for this service. I have tried both String and JSON for the Payload type, played around with quotes, escape characters, and similar. Any ideas on how to perform the conversion?

Enter image description here

profile pictureAWS
Ryan
已提问 2 年前341 查看次数
1 回答
2
已接受的回答

Hi Ryan. I haven't used it before, but I think you want the convert() function: https://docs.aws.amazon.com/iotevents/latest/developerguide/iotevents-expressions.html

profile pictureAWS
专家
Greg_B
已回答 2 年前
  • Thanks Greg, that was it. I looked all over that documentation and didn't come across that command...I think I need more coffee ;)

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

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

回答问题的准则