Numeric JSON results in step function are delivered as strings

0

When using GetQueueAttributes (SQS) to retrieve the number of messages available in a queue, the resulting JSON delivers numbers as strings, e.g. "ApproximateNumberOfMessages": "18"

That means a Choice step can't do a numeric comparison. I know in this particular case I'm always going to get a number, so I can use StringGreaterThan etc., but it's semantically wrong.

How can I convert the string value to a number so I can use numeric comparison operators?

boukasa
質問済み 2年前916ビュー
2回答
0

You need to go step further and learn how comparison is done. It's done by functions Numeric Equals or StringEquals, so your input will be interpreted by the function you choose.

回答済み 2年前
0

Use the States.StringToJson function to convert string to number

"NumberValue.$": "States.StringToJson("$.numberAsString")"
AWS
回答済み 5ヶ月前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ