You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 10, 2025. It is now read-only.
I've noticed that django-json-field treats my floating point data as Decimal type. I've seen why you did it by looking at the issues history of the project on GitHub, but I think it's really inconvenient, here's why:
Python's default fast JSON encoder (json.dumps) written in C chokes when I give it data I got from a JSONField field (as a part of a larger structure), forcing me to use a custom encoder in Python, which is orders of magnitude slower.
Decimal data type itself is hugely slower than float
All modern browsers treat the JavaScript "number" type internally as a double precision float, so the added precision of Decimal is lost when transferred to the browser. JSON is not JavaScript, but you must admit it's most commonly used as such.
Could you make an option to be used in the field declaration to treat floats as floats? E.g.
f = JSONField(null=True, pure_float=True)
I've noticed that django-json-field treats my floating point data as Decimal type. I've seen why you did it by looking at the issues history of the project on GitHub, but I think it's really inconvenient, here's why:
Could you make an option to be used in the field declaration to treat floats as floats? E.g.
f = JSONField(null=True, pure_float=True)
... or something like it?