我的数据库表中有一个十进制列(精度:8,比例:2),我正在寻找一种简单的方法来格式化数字,如下所示:
# Currently, when I pass the data to json format, it shows like:
12 -> "12.0"
12.00 -> "12.0"
12.50 -> "12.5"
12.58 -> "12.58"
# What I need is strip any 0 at the end.
12 -> "12"
12.00 -> "12"
12.50 -> "12.5"
12.58 -> "12.58"