How to pass parse_float option to DRF json decoder #8488
Answered
by
yyyyyyyan
0xNima
asked this question in
Question & Answer
-
Hi. Is there any convenient way to pass the
but if decode it as I'm looking for a straightforward solution rather than defining a custom JSON parser. Like pass it from view as a class variable and use it in the parser |
Beta Was this translation helpful? Give feedback.
Answered by
yyyyyyyan
Jun 16, 2022
Replies: 2 comments
This comment has been minimized.
This comment has been minimized.
-
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi! The DRF builtin
JSONParser.parse()
always callsjson.load()
with two arguments - the data to be loaded andparse_constant
. You can either create a custom Parser or send the decimal number as a string you can properly convert to a Decimal with a serializer.