API Gateway mapping template transformation causes a precision error for exponential notation

0

Hello AWS re:Post professionals. Thanks in advance and I would like to ask a question about API Gateway mapping templates.

Situation: I have tried to post JSON that includes exponential notation API Gateway that uses mapping template and saw response below.

posted value

Method request body before transformations: {
...
"value": 5e+22
}
endpoint request body after transformations:     {
...
value: \"4.9999999999999996E22\" 
}

In mapping template, I have found that after the line below, value: 5e+22 was converted to 4.9999999999999996E22

#set($inputRoot = $input.path('$'))

My Question is that is there any way to avoid this implicit transformation?

Best regards, Keisuke

已提问 2 年前86 查看次数
没有答案

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

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

回答问题的准则