Disable scientific notation in response #7764
Answered
by
ramwin
khaitranquang
asked this question in
Question & Answer
-
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
So, how do i fix it?
Tks |
Beta Was this translation helpful? Give feedback.
Answered by
ramwin
Jan 25, 2021
Replies: 1 comment
-
This is not a problem with drf. It is the problem of json. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
tomchristie
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is not a problem with drf. It is the problem of json.
You can see some questions hear or hear.
I suggest you use
DecimalField
in your code instead.