Hi team,
I use DRF but I have an issue with float format in DRF Response. Here, my code:
from rest_framework.response import Response
# Some code ....
result = {
"origin_amount": 0.000000001,
"origin_amount_text": "",
"origin_currency": "USD",
"fee": {
"paypal_fee": 0.000000001,
"vat": 0.000000001,
"income_tax": 0.000000001,
"whitehub_fee": 0.000000001
},
"total_amount": 0.000000001,
"currency": "USD",
}
return Response(status=200, data=result)
I expetect it returns response as result dict. But it returns:
{"origin_amount": 1e-09, "origin_amount_text": "", "origin_currency": "USD", "fee": {"paypal_fee": 1e-09, "vat": 1e-09, "income_tax": 1e-09, "whitehub_fee": 1e-09}, "total_amount": 1e-09, "currency": "USD"}
So, how do i fix it?
My django and DRF version:
Django==2.0.5
djangorestframework==3.8.2
Tks
Hi team,
I use DRF but I have an issue with float format in DRF Response. Here, my code:
I expetect it returns response as
resultdict. But it returns:So, how do i fix it?
My django and DRF version:
Tks