I have a float let's say
x = 2.00
I want to send that as json
message = { 'x': 2.00 }
But when I do
print(message)
I see that python has dropped the last decimal place. How can I keep the float at two decimal places? I understand that 2.00 and 2.0 are not different but it's a requirement that I send that exact number (two decimal places included) (I have tried the Decimal class, it still acts the same and I need to send it as a float not a string). Thanks in advance.